public ActionResult New(PlanetTypeForm form) { Debug.WriteLine($"POST: Planet Type Controller: New - gameID={GameState.GameID}"); var game = GameState.Game; DB_planet_types planetType = new DB_planet_types(); planetType.game_id = game.Info.id; planetType.name = form.Name; Database.Session.Save(planetType); Database.Session.Flush(); return(RedirectToRoute("Statistics")); }
public ActionResult Edit(PlanetTypeForm form) { Debug.WriteLine($"POST: Planet Type Controller: Edit - planetTypeID={form.ID}"); var game = GameState.Game; var planetaryType = game.GameStatistics.PlanetTypes.Find(x => x.id == form.ID); if (planetaryType.game_id == null || planetaryType.game_id != game.Info.id) { return(RedirectToRoute("game", new { gameID = game.Info.id })); } planetaryType.name = form.Name; Database.Session.Update(planetaryType); Database.Session.Flush(); return(RedirectToRoute("Statistics")); }