public bool guardarDB(seg_menu_info info) { try { using (EntitiesFactElectronica Context = new EntitiesFactElectronica()) { seg_menu Entity = new seg_menu(); Entity.IdMenu = info.IdMenu = get_id(); Entity.IdMenu_padre = info.IdMenu_padre; Entity.me_nombre = info.me_nombre; Entity.me_es_menu = info.me_es_menu; Entity.me_nom_formulario = info.me_nom_formulario; Entity.me_nom_assembly = info.me_nom_assembly; Entity.me_nivel = info.me_nivel; Entity.me_estado = info.me_estado = true; Context.seg_menu.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool modificarDB(seg_menu_info info) { try { using (EntitiesFactElectronica Context = new EntitiesFactElectronica()) { seg_menu Entity = Context.seg_menu.FirstOrDefault(q => q.IdMenu == info.IdMenu); if (Entity != null) { Entity.IdMenu_padre = info.IdMenu_padre; Entity.me_nombre = info.me_nombre; Entity.me_es_menu = info.me_es_menu; Entity.me_nom_formulario = info.me_nom_formulario; Entity.me_nom_assembly = info.me_nom_assembly; Entity.me_nivel = info.me_nivel; Context.SaveChanges(); } } return(true); } catch (Exception) { throw; } }
public bool anularDB(seg_menu_info info) { try { using (EntitiesFactElectronica Context = new EntitiesFactElectronica()) { seg_menu Entity = Context.seg_menu.FirstOrDefault(q => q.IdMenu == info.IdMenu); if (Entity != null) { Entity.me_estado = false; Context.SaveChanges(); } } return(true); } catch (Exception) { throw; } }