// POST api/Account/AddPassword public async Task <IHttpActionResult> AddPassword(AddPasswordBindingModel model) { var currentUser = await UserManager.FindByIdAsync(this.GetCurrentUserId().Value); var result = await UserManager.AddPasswordAsync(currentUser.Id, model.Password); var errorResult = GetErrorResult(result); if (errorResult != null) { return(errorResult); } return(Ok(currentUser)); }
// POST api/Account/AddPassword public async Task<IHttpActionResult> AddPassword(AddPasswordBindingModel model) { if (!ModelState.IsValid) { return BadRequest(ModelState); } var currentUser = await UserManager.FindByIdAsync(this.GetCurrentUserId().Value); var result = await UserManager.AddPasswordAsync(currentUser.Id, model.Password); var errorResult = GetErrorResult(result); if (errorResult != null) { return errorResult; } return Ok(currentUser); }