示例#1
0
 static public Boolean eliminar(int PermissionId)
 {
     try {
         MenuContext db        = new MenuContext();
         var         permision = db.Permissions.Where(x => x.PermissionId == PermissionId).SingleOrDefault();
         db.Permissions.Remove(permision);
         return(true);
     }
     catch {
         return(false);
     }
 }
示例#2
0
 static public Permission agregar(Permission permision)
 {
     try
     {
         MenuContext db = new MenuContext();
         db.Permissions.Add(permision);
         db.SaveChanges();
     }
     catch {
         permision.ItemID = 0;
     }
     return(permision);
 }
示例#3
0
        static public Item agregar(Item item)
        {
            MenuContext db = new MenuContext();

            try {
                db.Items.Add(item);
                db.SaveChanges();
            }
            catch {
                item.ItemId = 0;
            }
            return(item);
        }
示例#4
0
 static public Boolean actualizar(Permission permision)
 {
     try {
         MenuContext db            = new MenuContext();
         var         old_permision = db.Permissions.Where(x => x.PermissionId == permision.PermissionId).SingleOrDefault();
         old_permision.crud    = permision.crud;
         old_permision.ItemID  = permision.ItemID;
         old_permision.rol_id  = permision.rol_id;
         old_permision.visible = permision.visible;
         db.SaveChanges();
         return(true);
     }
     catch {
         return(false);
     }
 }
示例#5
0
        static public Boolean eliminar(int ItemId)
        {
            MenuContext db = new MenuContext();

            try
            {
                var item = db.Items.Where(x => x.ItemId == ItemId).SingleOrDefault();
                db.Items.Remove(item);
                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#6
0
        static public Boolean actualizar(Item item)
        {
            MenuContext db = new MenuContext();

            try
            {
                var old_item = db.Items.Where(x => x.ItemId == item.ItemId).SingleOrDefault();
                old_item.icono  = item.icono;
                old_item.name   = item.name;
                old_item.orden  = item.orden;
                old_item.parent = item.parent;
                old_item.title  = item.title;
                old_item.url    = item.url;
                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }