Пример #1
0
        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());
            }
        }
Пример #2
0
        public void AddCarWash(CarWash carWash)
        {
            using (var db = new CarWashBookingDbContext(_context))
            {
                db.CarWashes.Add(carWash);

                db.SaveChanges();
            }
        }
Пример #3
0
 public WashBooking AddBooking(WashBooking booking)
 {
     using (var db = new CarWashBookingDbContext(_context))
     {
         db.WashBookings.Add(booking);
         db.SaveChanges();
         return(booking);
     }
 }
Пример #4
0
        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();
                }
            }
        }