public async Task DeleteCarWash(CarWash carWash) { using (var db = new CarWashBookingDbContext(_context)) { var result = await Task.FromResult(db.CarWashes.Remove(carWash)); var saved = await Task.FromResult(db.SaveChanges()); } }
public void AddCarWash(CarWash carWash) { using (var db = new CarWashBookingDbContext(_context)) { db.CarWashes.Add(carWash); db.SaveChanges(); } }
public WashBooking AddBooking(WashBooking booking) { using (var db = new CarWashBookingDbContext(_context)) { db.WashBookings.Add(booking); db.SaveChanges(); return(booking); } }
public async Task SaveCarWash(CarWash carWash) { using (var db = new CarWashBookingDbContext(_context)) { var result = await Task.FromResult(db.CarWashes.Where(w => w.ID == carWash.ID).FirstOrDefault()); if (result != null) { result.Adresse = carWash.Adresse; result.Name = carWash.Name; result.Image = carWash.Image; db.SaveChanges(); } } }