Exemple #1
0
        public ActionResult AddDirectPaymentMethod(int Id_Order, FormCollection f)
        {
            Direct_Payment_Method directPM = new Direct_Payment_Method();

            directPM.Id_Order         = Id_Order;
            directPM.Shipping_Address = f.Get("txtAddressOrder").ToString();
            directPM.Mobile           = f.Get("txtMobileOrder").ToString();
            db.Direct_Payment_Method.Add(directPM);
            db.SaveChanges();
            Session["ShoppingCart"] = null;
            return(RedirectToAction("Index", "Home"));
        }
Exemple #2
0
        public ActionResult DeleteBill(int Id)
        {
            Order order = db.Orders.Single(n => n.Id == Id);
            List <Detail_Order>   lstdetailorder = db.Detail_Order.Where(n => n.Id_Order == Id).ToList();
            Direct_Payment_Method DPM            = db.Direct_Payment_Method.Single(n => n.Id_Order == Id);

            db.Direct_Payment_Method.Remove(DPM);
            foreach (var item in lstdetailorder)
            {
                db.Detail_Order.Remove(item);
            }
            db.Orders.Remove(order);
            db.SaveChanges();
            return(RedirectToAction("Profile", "User"));
        }
Exemple #3
0
        public List <DiscInBuyingHistory> GetDiscUnpaidBills()
        {
            int          Id_User  = int.Parse((Session["LogedUserID"]).ToString());
            List <Order> lstOrder = db.Orders.Where(n => n.Id_User == Id_User && n.IsPaid == 0).ToList();
            List <DiscInBuyingHistory>   lstDiscInBH = new List <DiscInBuyingHistory>();
            List <Direct_Payment_Method> lstDPM      = new List <Direct_Payment_Method>();

            foreach (var item in lstOrder)
            {
                List <Detail_Order> lstDetailOrder = db.Detail_Order.Where(n => n.Id_Order == item.Id).ToList();
                foreach (var item2 in lstDetailOrder)
                {
                    DiscInBuyingHistory discInBH = new DiscInBuyingHistory((int)item2.Id_Disc, (DateTime)item.Date, (int)item.Status);
                    discInBH.Number   = (int)item2.Quantity;
                    discInBH.Id_Order = (int)item.Id;
                    lstDiscInBH.Add(discInBH);
                }
                Direct_Payment_Method DPM = db.Direct_Payment_Method.SingleOrDefault(n => n.Id_Order == item.Id);
                lstDPM.Add(DPM);
            }
            ViewData["lstOrder"] = lstOrder;
            ViewData["lstDPM"]   = lstDPM;
            return(lstDiscInBH);
        }