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); } } }
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); } } }