////[Authorize(Roles = "Admin, CanEdit")] public ActionResult Edit(string id) { RolesBusiness rolesB = new RolesBusiness(); // It's actually the Role.Name tucked into the id param: var roleModel = rolesB.GetRole(id); return View(roleModel); }
//[Authorize(Roles = "Admin")] public ActionResult Delete(string id) { RolesBusiness rolesB = new RolesBusiness(); if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var role = rolesB.FirstRole(id); var model = new RoleViewModel();//role); if (role == null) { return HttpNotFound(); } return View(model); }
public ActionResult Create([Bind(Include = "RoleName,Description")]RoleViewModel model) { string message = "That role name has already been used"; if (ModelState.IsValid) { RolesBusiness rolesB = new RolesBusiness(); if (rolesB.Insert(model) != true) { return View(message); } else { return RedirectToAction("Index", "Roles"); } } return View(); }
public ActionResult Edit([Bind(Include = "RoleName,OriginalRoleName,Description")] EditRoleViewModel model) { RolesBusiness rolesB = new RolesBusiness(); if (ModelState.IsValid) { if (rolesB.Update(model)) return RedirectToAction("Index","Roles"); else { return View(model); } } return View(model); }
public ActionResult DeleteConfirmed(string id) { RolesBusiness rolesB = new RolesBusiness(); rolesB.Delete(id); return RedirectToAction("Index"); }
//[Authorize(Roles = "Admin")] public ActionResult Roleuser(string id) { RolesBusiness rolesB = new RolesBusiness(); return View(rolesB.GetRoleUsers(id)); }
//[Authorize(Roles = "Admin")] public ActionResult Index() { RolesBusiness rolesB = new RolesBusiness(); return View(rolesB.GetAllRoles()); }