public async Task <HttpResponse> CreateOrderPaypal(string fullname, string address, string street, string city, int IDBill)
        {
            try
            {
                //string strHost = HttpContext.Current.Request.Url.Host.ToString();
                CartDetailsModel cart = LoadCartDetailsModel(IDBill);
                //  string host = Request.Url.Host;

                //  string urlReturn = "https://" + host;
                //  if (host.Equals("localhost"))
                //  {
                //     urlReturn = urlReturn + ":" + HttpContext.Request.Url.Port;
                // }
                // MessageBox.Show(urlReturn);
                var request = new OrdersCreateRequest();
                request.Prefer("return=representation");
                request.RequestBody(CreateOrderSample.BuildRequestBody(fullname, address, street, city, cart));
                var response = await PayPalClient.client().Execute(request);

                var    createOrderResult = response.Result <Order>();
                string orderId           = createOrderResult.Id;
                string url = "https://www.sandbox.paypal.com/checkoutnow?token=" + orderId;
                Response.Redirect(url);
                return(response);
            }
            catch (Exception e)
            {
                SendMailSSL.SendErrorToAdmin("Error at CreateOrderPaypal: " + e.ToString());
            }
            return(null);
        }
        public IActionResult BuyMovies(string orderId)
        {
            var order = _context.Orders.Include(o => o.OrderedMovies).FirstOrDefault(o => o.OrderId == orderId);

            if (order == null)
            {
                return(RedirectToAction("Index"));
            }
            var createOrderResponse = CreateOrderSample.CreateOrder(order, true).Result;

            createOrderResult = createOrderResponse.Result <PayPalCheckoutSdk.Orders.Order>();
            return(Redirect(createOrderResult.Links[1].Href));
        }