Exemple #1
0
        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)));
        }
Exemple #2
0
        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
                });
            }
        }