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); } }
static public Permission agregar(Permission permision) { try { MenuContext db = new MenuContext(); db.Permissions.Add(permision); db.SaveChanges(); } catch { permision.ItemID = 0; } return(permision); }
static public Item agregar(Item item) { MenuContext db = new MenuContext(); try { db.Items.Add(item); db.SaveChanges(); } catch { item.ItemId = 0; } return(item); }
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); } }
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); } }
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); } }