Created
July 15, 2019 07:57
-
-
Save ducmeit1/8fd1cabd8689eb6c2812d8cfb5ec6c40 to your computer and use it in GitHub Desktop.
ThinController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AllowAnonymous] | |
[HttpPost] | |
public async Task<IHttpActionResult> Register (RegisterBindingModel model) { | |
if (!ModelState.IsValid) return BadRequest (ModelState); | |
var user = new User { | |
UserName = model.Email, | |
Email = model.Email, | |
DateOfBirth = DateTime.Parse (model.DateOfBirth.ToString (CultureInfo.InvariantCulture)), | |
PhoneNumber = model.PhoneNumber, | |
Name = model.Name | |
}; | |
var result = await UserManager.CreateAsync (user, model.Password); | |
if (!result.Succeeded) return GetErrorResult (result); | |
return Ok (); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment