public async Task <IActionResult> Edit(int id, [Bind("AddressId,PersonId,ZipId,StreetName,HouseNumber")] Address address) { if (id != address.AddressId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(address); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddressExists(address.AddressId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.PersonMigration, "PersonId", "FirstName", address.PersonId); ViewData["ZipId"] = new SelectList(_context.ZipMigration, "ZipId", "City", address.ZipId); return(View(address)); }
public async Task <IActionResult> Edit(int id, [Bind("PersonId,PersonType,FirstName,MiddleName,LastName")] 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("ZipId,City,Country,ZipCode")] Zip zip) { if (id != zip.ZipId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(zip); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ZipExists(zip.ZipId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(zip)); }
public async Task <IActionResult> Edit(int id, [Bind("EmailId,PersonId,EmailAddress")] Email email) { if (id != email.EmailId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(email); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmailExists(email.EmailId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.PersonMigration, "PersonId", "FirstName", email.PersonId); return(View(email)); }