public async Task <IActionResult> Edit(int id, [Bind("Id,Season,Year,StartDate,TerminationReason,OxygenUsed,PeakId,TrekkingAgencyId")] Expedition expedition) { if (id != expedition.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(expedition); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExpeditionExists(expedition.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PeakId"] = new SelectList(_context.Peaks, "Id", "Name", expedition.PeakId); ViewData["TrekkingAgencyId"] = new SelectList(_context.TrekkingAgencies, "Id", "Id", expedition.TrekkingAgencyId); return(View(expedition)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] TrekkingAgency trekkingAgency) { if (id != trekkingAgency.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(trekkingAgency); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrekkingAgencyExists(trekkingAgency.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(trekkingAgency)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Height,ClimbingStatus,FirstAscentYear")] Peak peak) { if (id != peak.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(peak); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PeakExists(peak.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(peak)); }