public async Task <IActionResult> PutAuthor([FromRoute] int id, [FromBody] Author author) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != author.Id) { return(BadRequest()); } _context.Entry(author).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuthorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task Insert(BookCart entity) { await _context.BookCarts.AddAsync(entity); await _context.SaveChangesAsync(); }
public async Task Insert(Category entity) { await _context.Categories.AddAsync(entity); await _context.SaveChangesAsync(); }