private static AdminProfile ToDomain(AdminProfileEntity entity) => new AdminProfile { AdminId = entity.AdminId, FirstName = entity.FirstName, LastName = entity.LastName, Email = entity.Email, PhoneNumber = entity.PhoneNumber, Company = entity.Company, Department = entity.Department, JobTitle = entity.JobTitle, };
public async Task <AdminProfileErrorCodes> InsertAsync(AdminProfile adminProfile) { using (var context = _contextFactory.CreateDataContext()) { var entity = await context.AdminProfiles.FindAsync(adminProfile.AdminId); if (entity != null) { return(AdminProfileErrorCodes.AdminProfileAlreadyExists); } entity = new AdminProfileEntity(adminProfile); entity = _encryptionService.Encrypt(entity); context.AdminProfiles.Add(entity); await context.SaveChangesAsync(); } return(AdminProfileErrorCodes.None); }