public ActionResult New(RadiationLevelForm form) { Debug.WriteLine($"POST: Radiation Level Controller: New - gameID={GameState.GameID}"); var game = GameState.Game; DB_radiation_levels radiationLevel = new DB_radiation_levels(); radiationLevel.game_id = game.Info.id; radiationLevel.name = form.Name; Database.Session.Save(radiationLevel); Database.Session.Flush(); return(RedirectToRoute("Statistics")); }
private DB_radiation_levels RetrieveRadiationLevel(string name) { var game = GameState.Game; var radiationLevel = Database.Session.Query <DB_radiation_levels>() .Where(x => x.game_id == null || x.game_id == game.ID) .Where(x => x.name == name) .FirstOrDefault(); if (radiationLevel == null) { radiationLevel = new DB_radiation_levels(); radiationLevel.game_id = game.ID; radiationLevel.name = name; Database.Session.Save(radiationLevel); } return(radiationLevel); }