Author : MD TAREQ HASSAN | Updated : 2021/11/16

In memory sample data for CRUD application

Domain Models

Enums/Region.cs

namespace BlazorWebAssemblyCrudApp.DomainModels.Enums
{
	public enum Region : byte
	{
		[Description("Asia")]
		Asia = 1,
		[Description("Australia")]
		Australia = 2,
		[Description("Africa")]
		Africa = 3,
		[Description("America")]
		America = 4,
		[Description("Europe")]
		Europe = 5
	}
}

EmployeeData/Rank.cs

namespace BlazorWebAssemblyCrudApp.DomainModels.EmployeeData
{
	public class Rank
	{
		public int Level { get; set; }
		public string Name { get; set; }
	}
}

EmployeeData/Employee.cs

using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace BlazorWebAssemblyCrudApp.DomainModels.EmployeeData
{
    public class Employee
    {
        public Guid Id { get; set; }

        [Required]
        public string FirstName { get; set; }

        [Required]
        public string LastName { get; set; }

        [EmailAddress]
        public string Email { get; set; }

        public DateTime JoinDate { get; set; }

        public Region EmployedRegion { get; set; }

        public Rank Rank { get; set; }

        public string AvatarIcon { get; set; } // as Base64String
    }
}

Service Interface

Services/IEmployeeService.cs

using BlazorWebAssemblyCrudApp.DomainModels.EmployeeData;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BlazorWebAssemblyCrudApp.InMemory.Services
{
    // CRUD operations
    interface IEmployeeService
    {
        // C -> Create
        Task<Guid> CreateEmployeeAsync(Employee newEmployee);


        // R -> Read
        Task<List<Employee>> GetEmployeesAsync(); // all
        Task<Employee> FindEmployeeAsync(Guid employeeId); // single employee
        Task<bool> EmployeeExistsAsync(Guid employeeId); // uses FindEmployeeAsync() in method body


        // U -> Update
        Task UpdateEmployeeAsync(Employee modifiedEmployee); // uses SaveChangesAsync() in method body


        // D - Delete
        Task<bool> DeleteEmployeeAsync(Guid employeeId); // uses FindEmployeeAsync() + SaveChangesAsync() in method body
    }
}

InMemory Implementation

Services/InMemoryEmployeeService.cs

using BlazorWebAssemblyCrudApp.DomainModels.EmployeeData;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;

namespace BlazorWebAssemblyCrudApp.InMemory.Services
{
    //
    // Registered to DI in Startup class as singleton
	// 
    public class InMemoryEmployeeService : IEmployeeService
    {

        #region Initialization

        private List<Employee> _employees = new List<Employee>();
        private async void Initialize()
        {
            _employees = await DevelopmentTimeDataProvider.GetEmployeesAsync();
        }

        #endregion

        public InMemoryEmployeeService()
        {
            Initialize();
        }

        public async Task<Guid> CreateEmployeeAsync(Employee newEmployee)
        {
            return await Task.Run(new Func<Guid>(() =>
            {

                var newId = Guid.NewGuid();
                newEmployee.Id = newId;

                _employees.Add(newEmployee);

                return newId;
            }));
        }

        public async Task<List<Employee>> GetEmployeesAsync()
        {
            return await DevelopmentTimeDataProvider.GetEmployeesAsync();
        }

        public async Task<Employee> FindEmployeeAsync(Guid employeeId)
        {
            return await Task.Run(new Func<Employee>(() =>
            {
                var employee = _employees.Find(e => e.Id == employeeId);

                return employee;
            }));
        }

        public async Task<bool> EmployeeExistsAsync(Guid employeeId)
        {
            return (await FindEmployeeAsync(employeeId) != null);
        }

        public async Task<bool> DeleteEmployeeAsync(Guid employeeId)
        {
            var employee = await FindEmployeeAsync(employeeId);
            if(employee == null)
            {
                return false;
            }

            return await Task.Run(new Func<bool>(() =>
            {
                _employees.Remove(employee);

                return true;
            }));
        }

        public async Task UpdateEmployeeAsync(Employee modifiedEmployee)
        {
            var employee = await FindEmployeeAsync(modifiedEmployee.Id);
            employee.FirstName = modifiedEmployee.FirstName;
            employee.LastName = modifiedEmployee.LastName;
            employee.Email = modifiedEmployee.Email;
            employee.EmployedRegion = modifiedEmployee.EmployedRegion;
            employee.Rank = modifiedEmployee.Rank;
        }
    }


    #region DevelopmentTimeDataProvider

    public class DevelopmentTimeDataProvider
    {

        #region Private Members

        private const string avatarBase64String = @"/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQTEhUUExMWFRUXGCAbGRcYGRocHBsgIRocGx4gICAYHysgISAxHBkeIj0hJSorLzAuHCQ1ODMsNyg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FlEkxjBk54/Ft/1k+vb7ZbF9hKJtaLpL6fxpZ5gyFTS2Tzz2scHkAAe+cV3Yk100fOq6aZkKlDuJAk8UihwAdoBPHc1jZqmE2mmc4+p/powMXjVzATQLA2Pe+P3zFlwuO64N2LMp7PkrmUF4wBgHuAeYAwBgDAGAMAYAwD0YB1f6FZYp4owinetBubXy2ao0bvue2b6pIwN22dB6loVmjeJvwutfb5/tkkyNFA+nOnIZ5WdEIgqRVCADcSUH5Dbe33OcmSV/sWnTkh4Ywf88hPuRQ//AHf5YSqJHlkH9T9ZmWZkifwio5Ze5BHbngfcZbhimm2RycpGrqOgl9JNqpJ5HkWMsu7kKfgE/OdyTaVIjiilIr/011ya2hdi6+EwUmrUVdXVkZjxPsac8UlaJfprRSanw/BUKY0qyTtJ7st9jx6Zoveii30WbWm6hJFq/D3s6PaUxuqbaCL9axN1SEYppsk06Y0iDxJWY7dlkWOH/FtNiyOM6lSIuW5zL6u6VHEd8Y2qzEbO4Fex/wBsy58SjTXc24MjkqZW8zGgYB//2Q==";

        private static List<string> Regions = Enum.GetNames(typeof(Region)).ToList();
        private static List<Rank> Ranks { get; set; } = new List<Rank> {
            new Rank(){ Level = 1, Name = "Trainee" },
            new Rank(){ Level = 2, Name = "System Engineer" },
            new Rank(){ Level = 3, Name = "Senior System Engineer" },
            new Rank(){ Level = 4, Name = "Technology Analyst" },
            new Rank(){ Level = 5, Name = "Technology Lead" },
            new Rank(){ Level = 6, Name = "Technology Architect" },
        };

        #endregion


        public static async Task<List<Employee>> GetEmployeesAsync()
        {
            return await Task.Run(new Func<List<Employee>>(() =>
            {

                return new List<Employee>() {

                    new Employee(){ Id = Guid.NewGuid(),
                        FirstName = "MD TAREQ",
                        LastName = "HASSAN",
                        Email = "hassan@hovermind.com",
                        JoinDate = Convert.ToDateTime("2020/04/27"),
                        EmployedRegion = Region.America,
                        Rank = Ranks.ElementAt(3),
                        AvatarIcon = avatarBase64String
                    },

                    new Employee(){ Id = Guid.NewGuid(),
                        FirstName = "JIM",
                        LastName = "BORDEN",
                        Email = "jim@hovermind.com",
                        JoinDate = Convert.ToDateTime("2010/05/11"),
                        EmployedRegion = Region.Asia,
                        Rank = Ranks.ElementAt(4),
                        AvatarIcon = avatarBase64String
                    },

                    new Employee(){ Id = Guid.NewGuid(),
                        FirstName = "OLEKSANDR",
                        LastName = "DROPAILO",
                        Email = "olek@hovermind.com",
                        JoinDate = Convert.ToDateTime("2012/02/09"),
                        EmployedRegion = Region.Europe,
                        Rank = Ranks.ElementAt(2),
                        AvatarIcon = avatarBase64String
                    },

                    new Employee(){ Id = Guid.NewGuid(),
                        FirstName = "SHEIKH",
                        LastName = "ASHADUZZAMAN",
                        Email = "asad@hovermind.com",
                        JoinDate = Convert.ToDateTime("2013/09/14"),
                        EmployedRegion = Region.Asia,
                        Rank = Ranks.ElementAt(3),
                        AvatarIcon = avatarBase64String
                    },

                    new Employee(){ Id = Guid.NewGuid(),
                        FirstName = "SHEIKH",
                        LastName = "ASHADUZZAMAN",
                        Email = "sahidul@hovermind.com",
                        JoinDate = Convert.ToDateTime("2015/03/25"),
                        EmployedRegion = Region.Africa,
                        Rank = Ranks.ElementAt(2),
                        AvatarIcon = avatarBase64String
                    }
                };
            }));
        }
    }

    #endregion
}

Dependency Injection setup in Startup

Startup.cs

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Server.CrudApp.InMemory.Services;

namespace BlazorWebAssemblyCrudApp.InMemory
{
    public class Startup
    {
        // ... ... ...
		
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddRazorPages();
            //services.AddServerSideBlazor();
			
            services.AddSingleton<IEmployeeService, InMemoryEmployeeService>();
        }

        // ... ... ...
    }
}