public ActionResult StartNewSubmit(Game game) { using (var db = Context.GameContext.Create()) { if (User != null && !string.IsNullOrEmpty(User.Identity.Name)) { var user = db.Users.First(F => F.Name == User.Identity.Name); game.User = user; } State start = new State(); start.VertexName = "Start_Initial"; start.Game = game; start.DateTime = new DateTime(2016, 1, 1); start.ShowDelta = true; start.ShowDebug = false; start.EdgeName = ""; start.Title = "Escalation"; start.CurrentState = true; game.States.Add(start); db.Games.Add(game); db.SaveChanges(); } Session["Game"] = game; return RedirectToAction("Index", "Game"); }
public GameListing(Game g) { Game = g; State = g.States.First(F => F.CurrentState); StateCount = g.States.Count(); }