public ActionResult Index()
 {
     if (HttpContext.User.Identity.IsAuthenticated)
     {
         int CurrentGame = (int)HttpContext.Profile.GetPropertyValue("CurrentGame");
         if (CurrentGame > 0)
         {
             Guid        player = (Guid)Membership.GetUser().ProviderUserKey;
             EventPlayer ep     = db.GetCurrentEventPlayer(CurrentGame, player);
             if (ep != null)
             {
                 //user is authenticated and in a game... go there!
                 return(RedirectToAction("Play", "Game"));
             }
             HttpContext.Profile.SetPropertyValue("CurrentGame", 0);
             //User is authenticated but hasn't joined a game, so...
             return(RedirectToAction("Join", "Game", new { id = DateTime.Now.Year }));
         }
         else
         {
             //User is authenticated but hasn't joined a game, so...
             return(RedirectToAction("Join", "Game", new { id = DateTime.Now.Year }));
         }
     }
     //not authenticated... show home page
     return(View());
 }
        public ActionResult Play()
        {
            Guid   guid  = (Guid)Membership.GetUser().ProviderUserKey;
            GameVM model = new GameVM();

            model.Event        = db.GetEventByYear((int)HttpContext.Profile.GetPropertyValue("CurrentGame"));
            model.EventPlayer  = db.GetCurrentEventPlayer(model.Event.Year, guid);
            model.PlayerScores = db.GetPlayerScoresForYear(model.Event.Year, guid);
            return(View(model));
        }