// GET: Permissions/Edit/5 public ActionResult Edit(Guid?id, bool sortByName = false, bool sortDesc = false) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var res = service.GetByID(id.Value); PermissionsCategory permissionsCategory = res.Entity; if (!res.Success) { return(Json(res.Message)); } if (permissionsCategory == null) { return(HttpNotFound()); } return(View(permissionsCategory)); }
// GET: PermissionProperties public ActionResult Index(Guid id, bool sortByName = false, bool sortDesc = false) { var res = CategoryService.GetByID(id, PermissionNavigationOptions.IncludeProperties); if (!res.Success) { return(Json(res.Message, JsonRequestBehavior.AllowGet)); } else { IEnumerable <PermissionProperty> props = res.Entity ?.PermissionProperties ?.Where(prop => !prop.IsCostLevel); if (props != null && props.Any()) { if (sortDesc) { if (sortByName) { props = props.OrderByDescending(x => x.Name); } else { props = props.OrderByDescending(x => x.ViewOrder); } } else { if (sortByName) { props = props.OrderBy(x => x.Name); } else { props = props.OrderBy(x => x.ViewOrder); } } } ViewBag.SortByName = sortByName; ViewBag.SortDesc = sortDesc; ViewBag.CategoryID = res.Entity.ID; ViewBag.CategoryName = res.Entity.Name; return(View(props)); } }