public IActionResult GetBook(int bookId) { if (!repository.Exists(bookId)) { return(NotFound()); } Book book = repository.GetById(bookId); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(View(book)); }
public IActionResult GetCategory(int categoryId) { if (!repository.Exists(categoryId)) { return(NotFound()); } Category book = repository.GetById(categoryId); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(book)); }
public IActionResult GetAuthor(int authorId) { if (!repository.Exists(authorId)) { return(NotFound()); } Author author = repository.GetById(authorId); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //return Ok(author); return(View(author)); }