public bool Update(StaffViewModel entity) { var staff = entity.MapToStaff(); staff.PasswordHash = EncodeUtilities.GetPasswordHash(entity.Password); staff.FullName = EncodeUtilities.StringNormalize(entity.FullName); return(_staffRepository.Update(staff)); }
public bool Add(StaffViewModel entity) { var staff = entity.MapToStaff(); staff.PasswordHash = EncodeUtilities.GetPasswordHash(entity.Password); staff.CreatedDate = DateTime.Now; staff.FullName = EncodeUtilities.StringNormalize(entity.FullName); staff.Account = GenerateAccount(entity.FullName); return(_staffRepository.Add(staff)); }