public IList <Container> Lista() { using (var contexto = new TerminalContext()) { return(contexto.Containers.Include("BL").ToList()); } }
public IList <BL> Lista() { using (var contexto = new TerminalContext()) { return(contexto.BLs.ToList()); } }
public void Atualiza(BL bl) { using (var contexto = new TerminalContext()) { contexto.Entry(bl).State = System.Data.Entity.EntityState.Modified; contexto.SaveChanges(); } }
public IList <Container> BuscaPorBL(int Id) { using (var contexto = new TerminalContext()) { return(contexto.Containers.Include("BL") .Where(c => c.BLId == Id).ToList()); } }
public void Adiciona(Container container) { using (var context = new TerminalContext()) { context.Containers.Add(container); context.SaveChanges(); } }
public BL BuscaPorId(int id) { using (var contexto = new TerminalContext()) { return(contexto.BLs .Where(c => c.Id == id) .FirstOrDefault()); } }
public void Apagar(int id) { using (var contexto = new TerminalContext()) { var container = contexto.Containers.Include("BL").Single(c => c.Id == id); contexto.Containers.Remove(container); contexto.SaveChanges(); } }
public Container BuscaPorId(int id) { using (var contexto = new TerminalContext()) { return(contexto.Containers.Include("BL") .Where(c => c.Id == id) .FirstOrDefault()); } }
public void Apagar(int id) { using (var contexto = new TerminalContext()) { var bl = contexto.BLs.Single(c => c.Id == id); var containers = contexto.Containers .Where(c => c.BLId == id); contexto.Containers.RemoveRange(containers); contexto.BLs.Remove(bl); contexto.SaveChanges(); } }
public void Adiciona(BL bl) { using (var context = new TerminalContext()) { if (BuscaPorId(bl.Id) == null) { context.BLs.Add(bl); context.SaveChanges(); } else { Atualiza(bl); } } }