public async Task <IActionResult> PutPersonas(int id, Models.Personas personaOneRequest) { using (Models.pruebacuatroContext db = new Models.pruebacuatroContext()) { if (id != personaOneRequest.Id) { return(BadRequest()); } db.Entry(personaOneRequest).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); } }
public async Task <ActionResult <Models.Personas> > DeletePersona(int id) { using (Models.pruebacuatroContext db = new Models.pruebacuatroContext()) { var persona = await db.Personas.FindAsync(id); if (persona == null) { return(NotFound()); } db.Personas.Remove(persona); await db.SaveChangesAsync(); return(persona); } }