public async Task <IActionResult> PutPerson([FromRoute] int id, [FromBody] Person person) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != person.PersonId) { return(BadRequest()); } _context.Entry(person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEmailAddress([FromRoute] int id, [FromBody] EmailAddress emailAddress) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != emailAddress.EmailAddressId) { return(BadRequest()); } _context.Entry(emailAddress).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmailAddressExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }