// // Get: /Manage/UpdateBiography public async Task <ActionResult> UpdateBiography() { var userId = User.Identity.GetUserId(); var updateBiographyViewModel = new UpdateBiographyViewModel() { Biography = await UserManager.GetBiographyAsync(userId), ProfilePicUrl = await UserManager.GetProfilePicUrlAsync(userId) }; return(View(updateBiographyViewModel)); }
public async Task <ActionResult> UpdateBiography(UpdateBiographyViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); if (user != null) { user.Biography = model.Biography; user.ProfilePicUrl = await UploadImageAsync(model.ProfilePicUrl, model.ProfilePicture) ?? user.ProfilePicUrl; await UserManager.UpdateAsync(user); } return(RedirectToAction("Index", new { Message = ManageMessageId.UpdateBiographySuccess })); }