Esempio n. 1
0
        public async Task <ActionResult> PatchBook(int id, [FromBody] PatchBookRequest request)
        {
            var book = await _bookService.PatchBook(id, request);

            if (book == null)
            {
                return(NotFound());
            }
            return(Ok(book));
        }
Esempio n. 2
0
        public async Task <Book> Update(int id, PatchBookRequest request)
        {
            var book = await _context.Books.FirstOrDefaultAsync(x => x.Id == id);

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

            book.Name = request.Name;
            await _context.SaveChangesAsync();

            return(book);
        }
        public async Task <Book> PatchBook(int id, PatchBookRequest request)
        {
            var book = await _bookRepository.Update(id, request);

            return(book);
        }