public GetCartDTO getSpecificSellCart(int id)
        {
            var request = new RestRequest("api/Carts/" + id, Method.GET);
            request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };

            var apiKey = Session["ApiKey"];
            var UserId = Session["UserId"];
            request.AddHeader("xcmps383authenticationkey", apiKey.ToString());
            request.AddHeader("xcmps383authenticationid", UserId.ToString());
            request.AddParameter("checkout", "huuuurrrrrduuuuurrrr");
            IRestResponse queryResult = client.Execute(request);
            GetCartDTO x = new GetCartDTO();

            statusCodeCheck(queryResult);

            if (queryResult.StatusCode == HttpStatusCode.OK)
            {
                RestSharp.Deserializers.JsonDeserializer deserial = new JsonDeserializer();
                x = JsonConvert.DeserializeObject<GetCartDTO>(queryResult.Content);
                x.Id = parseId(x.URL);
                foreach (var game in x.Games)
                {
                    var thing = db.Images.OrderBy(r => Guid.NewGuid()).Take(1).First();
                    game.Item1.imageSource = thing.imageSource;
                }
            }
            return x;
        }
        public void Sale(int id)
        {
            //get the cart we are selling

            var request = new RestRequest("api/Carts/" + id, Method.GET);
            request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };

            var apiKey = Session["ApiKey"];
            var UserId = Session["UserId"];
            request.AddHeader("xcmps383authenticationkey", apiKey.ToString());
            request.AddHeader("xcmps383authenticationid", UserId.ToString());
            request.AddHeader("checkout", "true");
            IRestResponse queryResult = client.Execute(request);
            GetCartDTO x = new GetCartDTO();

            statusCodeCheck(queryResult);

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

            }
            else if (queryResult.StatusCode == HttpStatusCode.Forbidden)
            {
            }

            //process the sale
            request = new RestRequest("api/Sales/", Method.POST);
            request.AddHeader("xcmps383authenticationkey", apiKey.ToString());
            request.AddHeader("xcmps383authenticationid", UserId.ToString());
            request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };
            request.RequestFormat = DataFormat.Json;
            request.AddBody(x);
            queryResult = client.Execute(request);

            statusCodeCheck(queryResult);

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

            }
            else if (queryResult.StatusCode == HttpStatusCode.Forbidden)
            {
            }
        }
        public ActionResult Details(int id)
        {
            var request = new RestRequest("api/Carts/" + id, Method.GET);
            request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };

            var apiKey = Session["ApiKey"];
            var UserId = Session["UserId"];
            request.AddHeader("xcmps383authenticationkey", apiKey.ToString());
            request.AddHeader("xcmps383authenticationid", UserId.ToString());
            request.AddQueryParameter("checkout", "true");
            IRestResponse queryResult = client.Execute(request);
            GetCartDTO x = new GetCartDTO();

            statusCodeCheck(queryResult);

            if (queryResult.StatusCode == HttpStatusCode.OK)
            {
                RestSharp.Deserializers.JsonDeserializer deserial = new JsonDeserializer();
                x = JsonConvert.DeserializeObject<GetCartDTO>(queryResult.Content);
            }
            else if (queryResult.StatusCode == HttpStatusCode.Forbidden)
            {
                return RedirectToAction("Login", "User");
            }

            return View(x);
        }