public JsonResult Update([DataSourceRequest] DataSourceRequest request, PermisoObjeto model) { if (ModelState.IsValid) { //KatharsisUser userInfo = (KatharsisUser)Session["nombre_usuario"]; if ((bool)model.TieneAcceso) { new PermisoObjeto().Add(model.IdObjeto, model.IdRol, "paguilar"); } else { new PermisoObjeto().Delete(model.IdObjeto, model.IdRol, "paguilar"); } } return(Json(new[] { model }.ToTreeDataSourceResult(request, ModelState))); }
public JsonResult Read_RoleToPermission([DataSourceRequest] DataSourceRequest request, int?pIdProduct, int?pIdRole) { if (pIdProduct != null && pIdRole != null) { List <PermisoObjeto> result = new PermisoObjeto().Get((int)pIdRole, (int)pIdProduct); return(new JsonNetResult { Data = result .ToTreeDataSourceResult(request), JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } else { List <PermisoObjeto> result = new List <PermisoObjeto>(); return(new JsonNetResult { Data = result .ToTreeDataSourceResult(request), JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }