예제 #1
0
 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,
 };
예제 #2
0
        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);
        }