コード例 #1
0
        public async Task <ActionResult> UpdateGere(int bookId, [FromBody] string newGenre)
        {
            var book = await _context.Books.Where(b => b.Id == bookId).SingleOrDefaultAsync();

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

            book.Genre = newGenre;
            _context.Update(book);
            await _context.SaveChangesAsync();

            return(NoContent());
        }
コード例 #2
0
 public async Task Update(T entity)
 {
     _context.Update(entity);
     await _context.SaveChangesAsync();
 }