public static User MapWithPasswordHashToEntity(UserDetailModel detailModel) { var passwordHandler = new PasswordHandler(); var user = new User { Id = detailModel.Id, Name = detailModel.Name, Email = detailModel.Email, Password = passwordHandler.HashPassword(detailModel.Password), }; foreach (var activity in detailModel.Activities) { user.Activities.Add(ActivityMapper.MapToEntity(activity)); } foreach (var team in detailModel.Teams) { user.Teams.Add(TeamUserMapper.MapToEntity(team, MapToListModel(user))); } return(user); }
public static User MapToEntity(UserDetailModel detailModel) { var user = new User { Id = detailModel.Id, Name = detailModel.Name, Email = detailModel.Email, Password = detailModel.Password, LastLoginTime = detailModel.LastLoginTime }; foreach (var activity in detailModel.Activities) { user.Activities.Add(ActivityMapper.MapToEntity(activity)); } foreach (var team in detailModel.Teams) { user.Teams.Add(TeamUserMapper.MapToEntity(team, MapToListModel(user))); } return(user); }