Exemplo n.º 1
0
        public ActionResult CheckOut(int CustomerId)
        {
            int P_ID, Qty;

            //create New Purchase Record
            PurchaseData.CreateNewPurchase(CustomerId);
            foreach (string key in Request.Form.AllKeys)
            {
                //Debug.WriteLine("Keys : : : " + key);
                //Debug.WriteLine("Value : : : " + Request[key]);
                if (key != "CheckOut")
                {
                    P_ID = Convert.ToInt32(key);
                    Qty  = Convert.ToInt32(Request[key]);

                    for (int i = 0; i < Qty; i++)
                    {
                        PurchaseData.InsertNewPurchses(P_ID);
                    }
                }
            }
            //delete form Cart
            CartData.ClearCart(CustomerId);
            Customer customer_data = CustomerData.GetCustomerByCustomerId(CustomerId);
            string   session       = customer_data.SessionId;

            return(RedirectToAction("Index", "Purchases", new { sessionId = @session }));
        }