Exemplo n.º 1
0
        public async Task <IActionResult> UpdateBook([FromBody] BookDTO book)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!_bookService.BookExists(book.BookId))
            {
                return(NotFound("Nie znaleziono książki!"));
            }

            try
            {
                _bookService.UpdateBook(book);
            }
            catch (DbUpdateConcurrencyException)
            {
            }
            return(Ok());
        }