public static UserServiceModel mapUserEntityToModel(User user) { UserServiceModel model = new UserServiceModel(); model.firstname = user.FirstName; model.lastname = user.LastName; model.middlename = user.MiddleName; model.scrumRole = mapUserRoleToScrum(user.ScrumRole); model.defectRole = mapUserRoleToDefect(user.ScrumRole); model.username = user.UserName; model.lastUpdatedDate = user.LastUpdatedDate; model.id = user.Id; return model; }
public int InsertUser(UserServiceModel user) { UserRepository repo = new UserRepository(entities); User model = new User(); Tuple<string, string> hashSalt = UserUtil.encryptPassword(user.password); model.FirstName = user.firstname; model.LastName = user.lastname; model.MiddleName = user.middlename; model.Id = 0; model.UserName = user.username; model.Password = hashSalt.Item1; model.Salt = hashSalt.Item2; model.PasswordExpireDate = DateTime.Now.AddMonths(3); model.DefectRole = UserUtil.unmapUserRoleToDefect(user.defectRole); model.ScrumRole = UserUtil.unmapUserRoleToScrum(user.scrumRole); return repo.Insert(model); }