static void Main(string[] args) { using (var context = new MapContext()) { context.Maps.ToList(); } }
public void AddDriver(Driver driver) { using (var context = new MapContext()) { context.Drivers.Add(driver); context.SaveChanges(); } }
public void AddCargo(Cargo cargo) { using (var context = new MapContext()) { context.Cargoes.Add(cargo); context.SaveChanges(); } }
public void DeleteDriver(int id) { using (var context = new MapContext()) { var driver = context.Drivers.FirstOrDefault(d => d.Id == id); if (driver != null) { context.Drivers.Remove(driver); context.SaveChanges(); } } }
public void DeleteCargo(int id) { using (var context = new MapContext()) { var cargo = context.Cargoes.FirstOrDefault(c => c.Id == id); if (cargo != null) { context.Cargoes.Remove(cargo); context.SaveChanges(); } } }