public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,MiddleName,LastName,DateOfBirth")] Person person) { if (id != person.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(person)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Latitude,Longitude")] Location location) { if (id != location.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(location); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationExists(location.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(location)); }