public async Task <IActionResult> PutDbCedula(int id, DbCedula dbCedula) { if (id != dbCedula.Id) { return(BadRequest()); } _context.Entry(dbCedula).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DbCedulaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DbCedula> > PostDbCedula([FromBody] DbCedula dbCedula) { var todoItem = new DbCedula { Cedula = dbCedula.Cedula, Nombre = dbCedula.Nombre, Apellido = dbCedula.Apellido, Email = dbCedula.Email, Tel = dbCedula.Tel, FechaNacimiento = dbCedula.FechaNacimiento, LugarNacimiento = dbCedula.LugarNacimiento }; _context.Cedulas.Add(todoItem); await _context.SaveChangesAsync(); if (ModelState.IsValid) { BadRequest(); } return(CreatedAtAction(nameof(GetDbCedula), new { id = todoItem.Id }, todoItem)); }