public async Task <IActionResult> PutAlliancesEntry(int id, AlliancesEntry alliancesEntry)
        {
            if (id != alliancesEntry.Id)
            {
                return(BadRequest());
            }

            _context.Entry(alliancesEntry).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AlliancesEntryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutFleet(int id, Fleet fleet)
        {
            if (id != fleet.Id)
            {
                return(BadRequest());
            }

            _context.Entry(fleet).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FleetExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #3
0
        public async Task <IActionResult> PutCommander(int id, Commander commander)
        {
            if (id != commander.Id)
            {
                return(BadRequest());
            }

            _context.Entry(commander).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CommanderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #4
0
        public async Task <IActionResult> PutGovernmentType(int id, GovernmentType governmentType)
        {
            if (id != governmentType.Id)
            {
                return(BadRequest());
            }

            _context.Entry(governmentType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GovernmentTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutShipyard(int id, Shipyard shipyard)
        {
            if (id != shipyard.Id)
            {
                return(BadRequest());
            }

            _context.Entry(shipyard).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ShipyardExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,Name")] StarType starType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(starType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(starType));
        }
Example #7
0
        public async Task <IActionResult> Create([Bind("Id,Name,Power")] Alliance alliance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(alliance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(alliance));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Pipelines,PlanetId,Staff")] Shipyard shipyard)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shipyard);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlanetId"] = new SelectList(_context.Planets, "Id", "Name", shipyard.PlanetId);
            return(View(shipyard));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Age,Size,TypeId")] Star star)
        {
            if (ModelState.IsValid)
            {
                _context.Add(star);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TypeId"] = new SelectList(_context.StarTypes, "Id", "Name", star.TypeId);
            return(View(star));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,GovernmentTypeId,Power,Ruler")] Empire empire)
        {
            if (ModelState.IsValid)
            {
                _context.Add(empire);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GovernmentTypeId"] = new SelectList(_context.GovernmentTypes, "Id", "Name", empire.GovernmentTypeId);
            return(View(empire));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Gender,Age,RankId,Skill")] Commander commander)
        {
            if (ModelState.IsValid)
            {
                _context.Add(commander);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RankId"] = new SelectList(_context.Ranks, "Id", "Name", commander.RankId);
            return(View(commander));
        }
Example #12
0
        public async Task <IActionResult> Create([Bind("Id,AllianceId,EmpireId,EntryYear")] AlliancesEntry alliancesEntry)
        {
            if (ModelState.IsValid)
            {
                _context.Add(alliancesEntry);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AllianceId"] = new SelectList(_context.Alliances, "Id", "Name", alliancesEntry.AllianceId);
            ViewData["EmpireId"]   = new SelectList(_context.Empires, "Id", "Name", alliancesEntry.EmpireId);
            return(View(alliancesEntry));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,CommanderId,StatusId")] Fleet fleet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(fleet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CommanderId"] = new SelectList(_context.Commanders, "Id", "Name", fleet.CommanderId);
            ViewData["StatusId"]    = new SelectList(_context.Statuses, "Id", "Name", fleet.StatusId);
            return(View(fleet));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Approval,EmpireId,Habitability,Population,Size,StarId")] Planet planet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(planet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpireId"] = new SelectList(_context.Empires, "Id", "Name", planet.EmpireId);
            ViewData["StarId"]   = new SelectList(_context.Stars, "Id", "Name", planet.StarId);
            return(View(planet));
        }
Example #15
0
        public async Task <IActionResult> Create([Bind("Id,Name,Capacity,Energy,Firepower,FleetId,Fuel,Hull,ShipyardId,Speed,Staff,Weight")] Spaceship spaceship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(spaceship);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FleetId"]    = new SelectList(_context.Fleets, "Id", "Name", spaceship.FleetId);
            ViewData["ShipyardId"] = new SelectList(_context.Shipyards, "Id", "Name", spaceship.ShipyardId);
            return(View(spaceship));
        }