public IActionResult Update(BookDto book) { try { if (ModelState.IsValid) { _booksService.Update(book.ToModel()); return(Ok()); } else { return(BadRequest(ModelState)); } } catch (Exception) { return(StatusCode(500)); } }
public async Task <IActionResult> UpdateBook(int id, [FromBody] BookDto book) { await _booksManager.UpdateBookAsync(id, book.ToModel()); return(Ok()); }
public async Task <IActionResult> CreateBook([FromBody] BookDto book) { await _booksManager.CreateBookAsync(book.ToModel()); return(Ok()); }