示例#1
0
 public void Delete(int carId)
 {
     using (var context = new WorkschopContext())
     {
         try
         {
             context.Remove(context.Cars.Find(carId));
             context.SaveChanges();
         }
         catch (Exception exception)
         {
             Console.WriteLine(exception.Message);
         }
     }
 }
示例#2
0
 public void Delete(int id)
 {
     using (var context = new WorkschopContext())
     {
         var deletedOwner = context.Owners.Find(id);
         try
         {
             context.Remove(deletedOwner);
             context.SaveChanges();
         }
         catch (Exception exception)
         {
             Console.WriteLine(exception.Message);
         }
     }
 }