public async Task <ActionResult> Update(int id, [FromBody] BookRequest bookModel) { if (id != bookModel.Id) { return(BadRequest()); } var book = _mapper.Map <Book>(bookModel); try { await _bookRepository.Update(book); } catch (DbUpdateConcurrencyException) { if (!_bookRepository.BookExists(book.Id)) { return(NotFound()); } } return(NoContent()); }