Exemplo n.º 1
0
        public ActionResult Home()
        {
            var currentstock = _productService.GetProducts();
            var paymenttypes = _paymentDetailService.GetPaymentTypes();
            var orders       = _orderService.GetOrders();

            List <TotalSales> totalSales = new List <TotalSales>();
            TotalSales        sale       = new TotalSales();

            foreach (var p in paymenttypes)
            {
                sale = new TotalSales()
                {
                    PaymentDesc = p.PaymtType, TotalAmount = _paymentDetailService.GetSalesByType(p.PaymtId)
                };
                totalSales.Add(sale);
            }
            ViewData["canssold"]     = orders;
            ViewData["currentstock"] = currentstock;
            ViewData["totalsales"]   = totalSales;
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Order(int prodId)
        {
            var products = _productService.GetProducts();
            var product  = products.FirstOrDefault(x => x.ProdId == prodId);
            IList <PaymentType> paymentTypes = null;

            if (product != null)
            {
                if (product.ProdQty < 1)
                {
                    ViewBag.Message = "The selected item is out of stock. Please try again and select some other item.";
                    return(View());
                }
                ViewData["SelectedProduct"] = product;
                paymentTypes = _paymentDetailService.GetPaymentTypes();
            }
            else
            {
                ViewBag.InvalidProductMessage = "Invalid Product";
            }

            return(View(paymentTypes));
        }