Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }