public void AddOrder(OrderDetail order)
 {
     // HTTP POST
     HttpClient c = new HttpClient();
     c.BaseAddress = new Uri(API.GetUrlAPI());
     c.DefaultRequestHeaders.Accept.Clear();
     c.DefaultRequestHeaders.Accept.Add(
         new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")
     );
     HttpResponseMessage response = c.PostAsJsonAsync(
         "api/order/add",
         order
     ).Result;
 }
        public ActionResult CheckoutSuccess()
        {
            //Luu thong tin don hang tai day dua vao thong tin session
            //kiem tra coi da dang nhap hay chua de hien thi View tuong ung

            string username = SessionHelper.GetUserSession();
            ReceiverViewModel receiver = SessionHelper.GetReceiverSession();
            OrderDetail order = new OrderDetail();

            if (username != null)//da dang nhap //thong tin nguoi mua
            {
                order.listCartSession = SessionHelper.GetCartSession(username); //san pham
                if (receiver != null) //thong tin nguoi nhan
                {
                     order.TotalMoney = code.Summoney(order.listCartSession);
                     order.receive = receiver;

                     code.AddOrder(order);
                    SendNotificationEmail(SessionHelper.GetUserSession(),order.TotalMoney);
                     //xóa session giỏ hàng và người nhận đi.
                     Session["receiver"] = null;
                     Session[username] = null;
                }
            }
            else
            {
                order.listCartSession = SessionHelper.GetCartSession("cart"); //san pham
                if (receiver != null) //thong tin nguoi nhan
                {
                    order.TotalMoney = code.Summoney(order.listCartSession);
                    order.receive = receiver;
                    code.AddOrder(order);
                    //xóa session giỏ hàng và người nhận đi.
                    HttpContext.Session["receiver"] = null;
                    HttpContext.Session[username] = null;
                    }
                }

            return View();
        }