Example #1
0
        public ActionResult AddPurchase(int id)
        {
            //create an empty cart

            Purchase purchase = new Purchase();
            {
                purchase.CreatedOn = DateTime.Now;
                purchase.Id = z; }

            decimal k = 0;

            foreach (var find in products)
            {

                if (find.CartId == id)
                {

                    k =k+ find.Price;

                }

            }
            purchase.TotalPrice = k;
            purchases.Add(purchase);

            return View(purchase);
        }
        public ActionResult Purchase(Guid? id)
        {
            Purchase purchase = new Purchase();
            purchase.ID = Guid.NewGuid();
            purchase.Date = DateTime.Now;

            purchase.List = Cart.List.ToList();
            purchase.totalammount = Cart.Total;

            dbPurchases.purchases.Add(purchase);
            dbPurchases.SaveChanges();
            Cart.List.Clear();
            Cart.Total = 0;

            return View(purchase);
        }
 public ActionResult Purchase()
 {
     Purchase siparis = new Purchase();
     decimal totalprice = 0;
     siparis.PurchaseList = new List<Product>();
     foreach (Product p in (List<Product>)TempData["Cartlist"])
     {
         siparis.PurchaseList.Add(p);
         totalprice = p.Price + totalprice;
     }
     siparis.Id = purchaseid;
     purchaseid = purchaseid + 1;
     siparis.TotalPrice = totalprice;
     TempData["Siparis"] = siparis;
     i++;
     return View(siparis);
 }
        public ActionResult Purchase()
        {
            Purchase purchase = new Purchase();
            decimal totalprice = 0;
            purchase.PurchaseList = new List<Product>();
            foreach (Product p in CartProducts)
            {
                purchase.PurchaseList.Add(p);
                totalprice = p.Price + totalprice;

            }
            purchase.TotalPrice = totalprice;

            return View(purchase);
        }
Example #5
0
        public ActionResult SavePurchase(Purchase purchase)
        {
            foreach (var find in products)
            {

                if (find.CartId !=0)
                {

                    find.CartId =0;

                }

            }
            z++;
            return View(purchase);
        }