public async Task <IActionResult> Edit(int id, [Bind("NationId,NationName")] Nation nation) { if (id != nation.NationId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NationExists(nation.NationId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nation)); }
public async Task <IActionResult> Edit(int id, [Bind("TankTypeId,TankTypeName")] TankType tankType) { if (id != tankType.TankTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tankType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TankTypeExists(tankType.TankTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tankType)); }
public async Task <IActionResult> Edit(int id, [Bind("TankId,TankName,TankTier,FirePower,Survivability,Mobility,Concealment,Spotting,TankTypeId,NationId")] Tank tank) { if (id != tank.TankId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tank); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TankExists(tank.TankId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["NationId"] = new SelectList(_context.Nations, "NationId", "NationId", tank.NationId); ViewData["TankTypeId"] = new SelectList(_context.TankTypes, "TankTypeId", "TankTypeId", tank.TankTypeId); return(View(tank)); }