public void DeleteCars(List <int> ids) { using var context = new PeopleCarsDbContext(_connectionString); var carsToDelete = context.Cars.Where(c => ids.Contains(c.Id)); context.Cars.RemoveRange(carsToDelete); context.SaveChanges(); }
public void AddCar(Car c) { using var context = new PeopleCarsDbContext(_connectionString); context.Cars.Add(c); context.SaveChanges(); }
public void AddPerson(Person p) { using var context = new PeopleCarsDbContext(_connectionString); context.People.Add(p); context.SaveChanges(); }