예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }