public IActionResult Create([FromBody] Parto pa) { if (pa == null) { return(BadRequest()); } _context.Partos.Add(pa); _context.SaveChanges(); return(CreatedAtRoute("Parto", new { id = pa.Id }, pa)); }
public IActionResult Update(int id, [FromBody] Parto pa) { if (pa == null || pa.Id != id) { return(BadRequest()); } var par = _context.Partos.FirstOrDefault(p => p.Id == id); if (par == null) { return(NotFound()); } par.LocalNasci = pa.LocalNasci; par.Horario = pa.Horario; _context.Partos.Update(par); _context.SaveChanges(); return(new NoContentResult()); }