Exemple #1
0
 static void Main(string[] args)
 {
     using (var context = new MapContext())
     {
         context.Maps.ToList();
     }
 }
Exemple #2
0
 public void AddDriver(Driver driver)
 {
     using (var context = new MapContext())
     {
         context.Drivers.Add(driver);
         context.SaveChanges();
     }
 }
Exemple #3
0
 public void AddCargo(Cargo cargo)
 {
     using (var context = new MapContext())
     {
         context.Cargoes.Add(cargo);
         context.SaveChanges();
     }
 }
Exemple #4
0
 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();
         }
     }
 }
Exemple #5
0
 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();
         }
     }
 }