public async Task <ActionResult <Solvente> > PostSolvente(Solvente solvente) { _context.Solventes.Add(solvente); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSolvente", new { id = solvente.Id }, solvente)); }
public async Task <IActionResult> PutSolvente(int id, Solvente solvente) { if (id != solvente.Id) { return(BadRequest()); } _context.Entry(solvente).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SolventeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }