public ActionResult Edit(Guid?id) { if (id == null) { GetAlert(Danger, "ID cannot e null!"); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var role = TheRoleManager.GetRoleById(id); if (role == null) { GetAlert(Danger, "Role cannot be found!"); return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } var model = new RoleVm.Edit() { RoleId = role.RoleId, RoleName = role.Name, RoleDescription = role.Description, RoleEnabled = role.Enabled, RoleLocked = role.Locked }; return(View("Edit", model)); }
public ActionResult Edit(RoleVm.Edit model) { if (ModelState.IsValid) { _roleSvc.Edit(model.RoleId, model.RoleName, model.RoleDescription); GetAlert(Success, "Role updated!"); return(RedirectToAction("Index")); } GetAlert(Danger, "Error!"); return(View("Edit", model)); }
public ActionResult Edit(RoleVm.Edit model) { if (ModelState.IsValid) { TheRoleManager.UpdateRole(model.RoleId, model.RoleName, model.RoleDescription, model.RoleEnabled, model.RoleLocked); GetAlert(Success, "Role updated!"); return(RedirectToAction("Index")); } GetAlert(Danger, "Error!"); return(View("Edit", model)); }
public ActionResult Edit(Guid id) { var role = _roleSvc.GetById(id); if (role == null) { GetAlert(Danger, "Role cannot be found!"); return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } var model = new RoleVm.Edit() { RoleId = role.RoleId, RoleName = role.Name, RoleDescription = role.Description }; return(View("Edit", model)); }