Exemplo n.º 1
0
        public ActionResult <BookDTO> GetBookById([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            BookDTO book = _bookService.GetBookById(id);

            if (book == null)
            {
                return(NotFound(new { alert = "Książka o danym id nie istnieje!" }));
            }

            return(Ok(book));
        }
Exemplo n.º 2
0
        public ActionResult EditBook(int id)
        {
            Book book = BookService.GetBookById(id);

            if (book == null)
            {
                return(HttpNotFound());
            }

            return(PartialView(BookService.GetBookEntity(book)));
        }