예제 #1
0
        public async Task <IActionResult> Add(int ID)
        {
            //Get the game with the corresponding ID
            VideoGame g = await VideoGameDB.GetGameByID(ID, _context);

            //Convert game to string
            string data = JsonConvert.SerializeObject(g);

            CartHelper.Add(_httpAccessor, g);

            return(RedirectToAction("Index", "VideoGame"));
            //Set up cookie
            //CookieOptions options = new CookieOptions()
            //{
            //    Secure = true,
            //    MaxAge = TimeSpan.FromDays(2 * DaysInWeek)
            //};

            //THIS IS HOW YOU CREATE A COOKIE
            //_httpAccessor.HttpContext.Response.Cookies.Append("CartCookie", data, options);
        }
예제 #2
0
        public async Task <IActionResult> Delete(int ID)
        {
            VideoGame game = await VideoGameDB.GetGameByID(ID, context);

            return(View(game));
        }
예제 #3
0
        public async Task <IActionResult> Update(int id)
        {
            VideoGame game = await VideoGameDB.GetGameByID(id, context);

            return(View(game));
        }