public ActionResult Edit(GetSalesDTO editedSale)
 {
     return null;
 }
        public ActionResult Edit(int id)
        {
            var request = new RestRequest("api/Sales/" + id, Method.GET);
            var apiKey = Session["ApiKey"];
            var UserId = Session["UserId"];
            request.AddHeader("xcmps383authenticationkey", apiKey.ToString());
            request.AddHeader("xcmps383authenticationid", UserId.ToString());
            var queryResult = client.Execute(request);
            List<GetGameDTO> games = getGames();
            GetSalesDTO x = new GetSalesDTO();
            GetSalesDTO send = new GetSalesDTO();

            statusCodeCheck(queryResult);

            ViewBag.games = games;

            if (queryResult.StatusCode == HttpStatusCode.OK)
            {
                RestSharp.Deserializers.JsonDeserializer deserial = new JsonDeserializer();
                x = JsonConvert.DeserializeObject<GetSalesDTO>(queryResult.Content);

                x.Id = parseId(x.URL);
                send.Id = x.Id;
                send.SalesDate = x.SalesDate;
                send.Total = x.Total;
                send.URL = x.URL;
                send.Cart = new GetCartDTO();
                send.Cart.Games = new List<Tuple<GetGameDTO, int>>();
                foreach (var game in games)
                {
                    foreach (var thing in x.Cart.Games)
                    {
                        if (game.GameName != null)
                        {
                            if (game.GameName.Equals(thing.Item1.GameName))
                            {
                                game.check = true;

                            }
                        }
                    }
                }

                foreach (GetGameDTO game in games)
                {
                    if (x.Cart.Games.FirstOrDefault(m => m.Item1.GameName == game.GameName) != null)
                    {
                        send.Cart.Games.Add(Tuple.Create(game, x.Cart.Games.Where(m => m.Item1.GameName == game.GameName).FirstOrDefault().Item2));
                    }
                    else
                    {
                        send.Cart.Games.Add(Tuple.Create(game, 0));
                    }
                }

            }
            else if (queryResult.StatusCode == HttpStatusCode.Forbidden)
            {
                return RedirectToAction("Login", "User");
            }
            return View(send);
        }