public async Task <ActionResult <directiva> > Postdirectiva(directiva directiva) { _context.directiva.Add(directiva); await _context.SaveChangesAsync(); return(CreatedAtAction("Getdirectiva", new { id = directiva.id_directiva }, directiva)); }
public async Task <IActionResult> Putdirectiva(int id, directiva directiva) { if (id != directiva.id_directiva) { return(BadRequest()); } _context.Entry(directiva).State = EntityState.Modified; try { await _context.SaveChangesAsync(); return(CreatedAtAction("Getdirectiva", new { id = directiva.id_directiva }, directiva)); } catch (DbUpdateConcurrencyException) { if (!directivaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }