public ActionResult Delete(Guid?id) { if (id == null) { GetAlert(Danger, "ID cannot be 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.Delete() { RoleId = role.RoleId, Name = role.Name, Description = role.Description, RoleEnabled = role.Enabled, RoleLocked = role.Locked }; return(View("Delete", model)); }
public ActionResult Delete(RoleVm.Delete model) { if (ModelState.IsValid) { _roleSvc.Delete(model.RoleId); GetAlert(Success, "Role deleted!"); return(RedirectToAction("Index")); } GetAlert(Danger, "Error!"); return(View("Delete", model)); }
public ActionResult Delete(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.Delete() { RoleId = role.RoleId, RoleName = role.Name, RoleDescription = role.Description }; return(View("Delete", model)); }