public async Task <IActionResult> PutInvestigadores(string DNI, Investigadores investigadores) { if (DNI != investigadores.Dni) { return(BadRequest()); } _context.Entry(investigadores).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InvestigadoresExists(DNI)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Investigadores> > PostInvestigadores(Investigadores investigadores) { _context.Investigadores.Add(investigadores); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (InvestigadoresExists(investigadores.Dni)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetInvestigadores", new { DNI = investigadores.Dni }, investigadores)); }