public async Task <ActionResult <Person> > PutPerson(int id, Person person) { if (id != person.Id) { return(NotFound()); } if (_context.Find <Person>(id) != null) { _context.Update <Person>(person); await _context.SaveChangesAsync(); return(NoContent()); } else { _context.Add <Person>(person); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetPerson), new { person.Id }, person)); } }