Пример #1
0
        public async Task <Reservation> AddReservation(Reservation reservation)
        {
            var book = await _bookProvider.GetBook(reservation.BookId);

            if (book.Stock <= 0)
            {
                throw new Exception("Book not in stock");
            }
            book.Stock -= 1;
            var res = await _reservationProvider.AddReservation(reservation);

            await _bookProvider.EditBook(book);

            return(res);
        }
        public ActionResult Edit(int id)
        {
            var model = _bookProvider.EditBook(id);

            return(View(model));
        }
Пример #3
0
 public async Task <Book> EditBook(Book book)
 {
     return(await _bookProvider.EditBook(book));
 }