public async Task <IActionResult> Edit(int id, [Bind("Id,SwocaseName,LocationId,ShowCaseDescriptionId,PersonId")] ShowCase showCase) { if (id != showCase.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(showCase); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShowCaseExists(showCase.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LocationId"] = new SelectList(_context.Location, "Id", "LocationString", showCase.LocationId); ViewData["PersonId"] = new SelectList(_context.Person, "Id", "FullName", showCase.PersonId); ViewData["ShowCaseDescriptionId"] = new SelectList(_context.ShowCaseDescription, "Id", "ShowCaseInfo", showCase.ShowCaseDescriptionId); return(View(showCase)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,StreetAddress,ZipCode,County,Country,Ssn,PhoneNumber,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 async Task <IActionResult> Edit(int id, [Bind("Id,LocationName,LocationStreetAddress,LocationZipCode,LocationCounty,LocationCountry")] 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)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ShowCaseInfo")] ShowCaseDescription showCaseDescription) { if (id != showCaseDescription.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(showCaseDescription); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShowCaseDescriptionExists(showCaseDescription.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(showCaseDescription)); }