Пример #1
0
        public ActionResult Add(Models.PermisosModel model)
        {
            if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); }
            model.sesion = sesion;

            if (!sesion.permisos.havePermission(Privileges[0].Permiso))
                return Json(new { msg = Notification.notAccess() });
            try
            {
                if (model.Add())
                {
                    // Debug.WriteLine("entro class");
                    //  Debug.WriteLine("entro permi" + model.Permiso);
                    //  Debug.WriteLine("entro desc" + model.Description);



                    return Json(new { msg = Notification.Succes("Agregado Permiso con exito: " + model.Permiso) });
                }
                else { return Json(new { msg = Notification.Error(" Erro al agregar: " + model.Permiso) }); }
            }
            catch (Exception e)
            {
                return Json(new { msg = Factory.Notification.Error(e.Message) });

            }
        }
Пример #2
0
 public ActionResult Edit(Models.PermisosModel model)
 {
     if (model.Edit())
     {
         return Json(new JavaScriptSerializer().Serialize(model));
     }
     return View();
 }
Пример #3
0
        public ActionResult Delete(Models.PermisosModel model)
        {
            if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); }
            model.sesion = sesion;

            if (!sesion.permisos.havePermission(Privileges[0].Permiso))
                return Json(new { msg = Notification.notAccess() });
            try
            {
                if (model.Delete())
                {
                    return Json(new { msg = Notification.Succes("Eliminado Permiso con exito: " + model.Permiso) });
                }
                else { return Json(new { msg = Notification.Error(" Error al Eliminar: " + model.Permiso) }); }

            }
            catch (Exception e)
            {
                return Json(new { msg = Notification.Error(e.Message) });

            }
        }
Пример #4
0
        public ActionResult restringirPermiso(Models.PermisosModel model)
        {
            model.sesion = SessionDB.start(Request, Response, false, db); if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); }
            model.sesion = sesion;

           
            Debug.WriteLine("idrole>>>>>>>>>: " + model.idrole);
            Debug.WriteLine("permisos>>>>>>>>>: " + model.permisos);
            try
            {
                if (model.restringirPermiso())
                {
                    return Json(new { msg = Notification.Succes("Se han restringido los permisos al rol con exito: " + model.permisos) });
                }
                else { return Json(new { msg = Notification.Error(" Errro al agregar: " + model.permisos) }); }
            }
            catch (Exception e)
            {
                return Json(new { msg = Factory.Notification.Error(e.Message) });

            }

        }