public IHttpActionResult GetRole(int id) { Role role = _RDB.GetById(id); if (role == null) { return(NotFound()); } return(Ok(role)); }
public ActionResult Edit(int id) { ViewBag.Role = new SelectList(RoleRepo.Get(), "Id", "Name"); RoleViewModel model = RoleRepo.GetById(id); return(View("_Edit", model)); }
public ActionResult View(int id) { RoleViewModel model = RoleRepo.GetById(id); UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name); if (access.Role == "Admin") { return(PartialView("_View", model)); } else { return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" }))); } }
public ActionResult Edit(int id) { ViewBag.Role = new SelectList(RoleRepo.Get(), "Id", "Name"); RoleViewModel model = RoleRepo.GetById(id); UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name); if (access.Role == "Admin") { return(View("_Edit", model)); } else { return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" }))); } }
//DELETE public ActionResult Delete(int id) { RoleViewModel model = RoleRepo.GetById(id); return(View("_Delete", model)); }