Пример #1
0
        public ActionResult New(PlanetTierForm form)
        {
            Debug.WriteLine(string.Format("POST: Planetary Tier Controller: New - gameID={0}", GameState.GameID));
            var game = GameState.Game;

            DB_planet_tiers planetTier = new DB_planet_tiers();

            planetTier.game_id    = game.Info.id;
            planetTier.name       = form.Name;
            planetTier.build_rate = form.BuildRate;
            Database.Session.Save(planetTier);

            Database.Session.Flush();
            return(RedirectToRoute("Statistics"));
        }
Пример #2
0
        public ActionResult Edit(PlanetTierForm form)
        {
            Debug.WriteLine(string.Format("POST: Planetary Tier Controller: Edit - planetTierID={0}", form.ID));
            var game = GameState.Game;

            var planetaryTier = game.GameStatistics.PlanetTiers.Find(x => x.id == form.ID);

            if (planetaryTier.game_id == null || planetaryTier.game_id != game.Info.id)
            {
                return(RedirectToRoute("game", new { gameID = game.Info.id }));
            }

            planetaryTier.name       = form.Name;
            planetaryTier.build_rate = form.BuildRate;
            Database.Session.Update(planetaryTier);

            Database.Session.Flush();
            return(RedirectToRoute("Statistics"));
        }