public ActionResult New(StageOfLifeForm form) { Debug.WriteLine($"POST: Stage of Life Controller: New - gameID={GameState.GameID}"); var game = GameState.Game; DB_stage_of_life stageOfLife = new DB_stage_of_life(); stageOfLife.game_id = game.Info.id; stageOfLife.name = form.Name; Database.Session.Save(stageOfLife); Database.Session.Flush(); return(RedirectToRoute("Statistics")); }
public ActionResult Edit(StageOfLifeForm form) { Debug.WriteLine($"POST: Stage of Life Controller: Edit - stageOfLifeID={form.ID}"); var game = GameState.Game; var stageOfLife = game.GameStatistics.StageOfLife.Find(x => x.id == form.ID); if (stageOfLife.game_id == null || stageOfLife.game_id != game.Info.id) { return(RedirectToRoute("game", new { gameID = game.Info.id })); } stageOfLife.name = form.Name; Database.Session.Update(stageOfLife); Database.Session.Flush(); return(RedirectToRoute("Statistics")); }