public async Task <IActionResult> Create([Bind("NationId,NationName")] Nation nation) { if (ModelState.IsValid) { _context.Add(nation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nation)); }
public async Task <IActionResult> Create([Bind("TankTypeId,TankTypeName")] TankType tankType) { if (ModelState.IsValid) { _context.Add(tankType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tankType)); }
public async Task <IActionResult> Create([Bind("TankId,TankName,TankTier,FirePower,Survivability,Mobility,Concealment,Spotting,TankTypeId,NationId")] Tank tank) { if (ModelState.IsValid) { _context.Add(tank); await _context.SaveChangesAsync(); 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)); }