public int Insert(RelacionesTablas_BD tablas) { try { using (var context = new BarandillasEntities()) { context.RelacionesTablas_BD.Add(tablas); context.SaveChanges(); return(tablas.RelacionID); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public string Update(Tablas_BD tablas) { try { using (var context = new BarandillasEntities()) { context.Entry(tablas).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(tablas.Nombre); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public string Insert(Tablas_BD tablas) { try { using (var context = new BarandillasEntities()) { context.Tablas_BD.Add(tablas); context.SaveChanges(); return(tablas.Nombre); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public string Delete(int id) { try { using (var context = new BarandillasEntities()) { Tablas_BD tabla = context.Tablas_BD.Find(id); tabla.Estatus = false; context.Entry(tabla).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(tabla.Nombre); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void DeleteCampo(string id) { try { using (var context = new BarandillasEntities()) { var query = (from i in context.RelacionCamposTablas_BD where i.CampoTB == id select i).ToList(); foreach (var d in query) { context.RelacionCamposTablas_BD.Remove(d); } context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public string Delete(int id) { try { string data = null; using (var context = new BarandillasEntities()) { var query = (from i in context.RelacionesTablas_BD where i.TablaBaseID == id select i).ToList(); data = query[0].Tablas_BD.Nombre; foreach (var d in query) { context.RelacionesTablas_BD.Remove(d); } context.SaveChanges(); return(data); } } catch (Exception ex) { throw new Exception(ex.Message); } }