public static User Convert(RegisterUser user) { User dbUser = new User(); dbUser.FirstName = user.FirstName; dbUser.LastName = user.LastName; dbUser.PhoneNumber = user.PhoneNumber; dbUser.Password = user.CryptPass; dbUser.Username = user.Username; return dbUser; }
public HttpResponseMessage PostRegisterUser(RegisterUser userToRegister) { // user validation ApiValidator.ValidateName(userToRegister.FirstName, userToRegister.LastName); ApiValidator.ValidateUsername(userToRegister.Username); ApiValidator.ValidatePassword(userToRegister.CryptPass); ApiValidator.ValidatePhonenNumber(userToRegister.PhoneNumber); User dbUser = ApiToDbModelConverter.Convert(userToRegister); this.repo.RegisterUser(dbUser, userToRegister.Contacts); return this.Request.CreateResponse(HttpStatusCode.OK); }