internal User CreateModel(UserModel model, User datamodel = null) { var result = datamodel ?? new User(); result.DateOfBirth = model.DateOfBirth; result.UserName = model.Username; result.Email = model.Email; result.Forename = model.Forename; result.Surname = model.Surname; result.AvatarId = model.AvatarId; result.City = model.City; result.FavoriteEventType = model.FavoriteEventType; result.GenderType = model.GenderType; return result; }
public UserModel CreateViewModel(User datamodel) { if (datamodel == null) { throw new ArgumentNullException("datamodel"); } return new UserModel { Url = _UrlHelper.Link("GetUserById", new { id = datamodel.Id }), Id = datamodel.Id, Username = datamodel.UserName, Email = datamodel.Email, DateOfBirth = datamodel.DateOfBirth, Surname = datamodel.Surname, Forename = datamodel.Forename, AvatarId = datamodel.AvatarId, City = datamodel.City, FavoriteEventType = datamodel.FavoriteEventType, GenderType = datamodel.GenderType }; }