public IActionResult Edit(string id) { if (string.IsNullOrEmpty(id)) { return(NotFound()); } IdentityEditServiceModel model = this.identityService.GetUserEditDetailsById(id); if (model == null) { return(NotFound()); } return(View(model)); }
public async Task <IActionResult> Edit(string id, IdentityEditServiceModel model) { if (!ModelState.IsValid) { return(View(model)); } ICollection <IdentityError> errors = await this.identityService.Edit(id, model.Email, model.Password, model.Phone); if (errors.Any()) { foreach (IdentityError error in errors) { ModelState.AddModelError(string.Empty, error.Description); } return(View(model)); } TempData["SuccessMessage"] = $"User {model.Username} has been edited."; return(RedirectToAction(nameof(All))); }