//[ValidateAntiForgeryToken] public ActionResult Edit(int id, UserEditDetailedViewModel userForEditViewModel) { try { if (ModelState.IsValid) { UserProfileDTO userProfile = UserMapHelpers.MapUseProfileDetailedViewToDTO(userForEditViewModel); UserProfileDTO editedUserProfileDTO = userRepository.EditUser(userProfile); UserEditDetailedViewModel editedUserDetailedViewModel = UserMapHelpers.MapUseProfileEditDetailedDTOToView(editedUserProfileDTO); if (User.IsUserAdmin()) { return(RedirectToAction("Index", "Users")); } //return RedirectToAction("Edit", "Users", new { @id = id }); return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { ModelState.AddModelError(string.Empty, "Error!Sorry, something went wrong! Please retry the operation!"); return(View(userForEditViewModel)); } finally { } return(View(userForEditViewModel)); }
public ActionResult Edit(int id) { UserProfileDTO userProfileDTO = this.userRepository.GetUserByID(id); UserEditDetailedViewModel userDetailedViewModel = UserMapHelpers.MapUseProfileEditDetailedDTOToView(userProfileDTO); return(View(userDetailedViewModel)); }