예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetGames();
                GetPages();
            }
            else
            {
                int selectedGameId;
                if (int.TryParse(Request.Form["add"], out selectedGameId))
                {
                    Game selectedGame = gameStoreDataService.GetSelectedGame(selectedGameId);

                    if (selectedGame != null)
                    {
                        SessionHelper.GetCart(Session).AddItem(selectedGame, 1);
                        SessionHelper.Set(Session, SessionKey.RETURN_URL,
                                          Request.RawUrl);

                        Response.Redirect(RouteTable.Routes
                                          .GetVirtualPath(null, "cart", null).VirtualPath);
                    }
                }
            }
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         int gameId;
         if (int.TryParse(Request.Form["remove"], out gameId))
         {
             Game gameToRemove = gameStoreDataService.GetSelectedGame(gameId);
             if (gameToRemove != null)
             {
                 SessionHelper.GetCart(Session).RemoveLine(gameToRemove);
             }
         }
     }
 }