public ActionResult CreateUser(SharedModels.User user) { if (!((ControllerBase)this).User.HasClaim(ClaimTypes.Role, "Administrator")) { RedirectToAction("Index", "Home"); } try { _usersViewModel.Service.Create(user); return(RedirectToAction("users")); } catch (Exception exc) { return(View("Error", new ErrorViewModel() { RequestId = exc.Message })); } }
public ActionResult EditUser(SharedModels.User user) { if (!User.HasClaim(ClaimTypes.Role, "Administrator")) { RedirectToAction("Index", "Home"); } try { _usersViewModel.Service.Update(user); return(RedirectToAction("users")); } catch (Exception exc) { return(View("Error", new ErrorViewModel() { Message = exc.Message })); } }