public async Task <ActionResult <Livro> > Post(Livro livro) { _context.Livros.Add(livro); await _context.SaveChangesAsync(); return(CreatedAtAction("Get", new { id = livro.Id }, livro)); }
public async Task <ActionResult <Editora> > Post(Editora editora) { _context.Editoras.Add(editora); await _context.SaveChangesAsync(); return(CreatedAtAction("Get", new { id = editora.Id }, editora)); }
public async Task <IActionResult> PutTema(int id, Tema tema) { if (id != tema.Id) { return(BadRequest()); } _context.Entry(tema).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TemaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <Editora> CreateEditora(Editora editora) { _context.Editoras.Add(editora); await _context.SaveChangesAsync(); return(editora); }