Example #1
0
        public async Task <IActionResult> Create([Bind("OfficerID,LastName,FirstName,Years,Status,Rank")] Officer officer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(officer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(officer));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("AchievementID,SolderID,Description,Battle,Reward")] Achievement achievement)
        {
            if (ModelState.IsValid)
            {
                _context.Add(achievement);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(achievement));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("UnitID,Name,Numbers,OfficerID")] Unit unit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(unit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OfficerID"] = new SelectList(_context.Officers, "OfficerID", "OfficerID", unit.OfficerID);
            return(View(unit));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("SoldierID,LastName,FirstName,Status,Age,Birthplace,UnitID")] Soldier soldier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(soldier);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UnitID"] = new SelectList(_context.Units, "UnitID", "UnitID", soldier.UnitID);
            return(View(soldier));
        }