Ejemplo n.º 1
0
        public ActionResult Checkouts(string message)
        {
            List<InvoiceModel> model = new List<InvoiceModel>();
             if(message!=null)
             {
                 if(message=="success")
                 {
                     ViewBag.message = "Siparişiniz alınmıştır";
                 }
                 else if(message=="deleteSucc")
                 {
                     ViewBag.message = "Ürün Sepetten silinmiştir";
                 }
                 else
                 {
                     ViewBag.message = "Ürün Sepete Eklendi";

                 }

              
             }
            var invoiceProducts = _checkoutService.GetAllInvoice().Where(x=>x.Approval==false && x.CustomerID==CurrentUser.CustmerID);
            foreach (var item in invoiceProducts)
            {
                var product = _productService.GetProductByProductId(item.ProductId);
                model.Add(new InvoiceModel {DateTime=item.DateTime,Product=product,ProductNumber=item.ProductNumber,InvoiceId=item.ID });
                
            }
            var customerList=_customerService.GetAllCustomer().ToList();
            var invoice=_checkoutService.GetAllInvoice().Where(x=>x.Approval==true).ToList();
            var productList=_productService.GetAllProduct().ToList();
           int size= invoiceProducts.ToList().Count;
           //AprioriHelper helperSuggest = new AprioriHelper(customerList, productList, invoice, size);

           // helperSuggest.CreateProductSugges(invoiceProducts.ToList());
          
           // var gel = helperSuggest.ProductSuggestIds;
            
            return View(model);
        }
        public ActionResult CalculateProfit()
        {
            decimal totalCost  = 0;
            decimal totalPrice = 0;
            var     invoices   = _checkoutService.GetAllInvoice().Where(x => x.Approval);

            foreach (var item in invoices)
            {
                var product = _productservice.GetProductByProductId(item.ProductId);
                totalCost  = totalCost + product.ProductCost;
                totalPrice = totalPrice + product.ProductPrice;
            }
            decimal a = totalPrice - totalCost;

            ViewBag.TotalProfit = a.ToString("C");
            return(View());
        }