public async Task <IActionResult> Edit(int id, [Bind("PersonId,FirstName,LastName,BirthDate,IsApproved,Role")] Person person) { if (id != person.PersonId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.PersonId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(person)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Title,Age,Address,City,Phone,Email")] 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 IActionResult Edit(Person person) { _context.Update(person); _context.SaveChanges(); return(RedirectToAction("Index")); }
public bool UpdatePerson(Person person) { _context.Update(person); _context.SaveChanges(); return(true); }