예제 #1
0
        // GET: Home
        public ActionResult Index()
        {
            MyRepository repository = new MyRepository();

            ViewBag.Products = repository.GetAvailableProducts().ToList();
            List <StockOutDTO> lst = repository.GetStockOuts().ToList();

            ViewBag.Earning  = lst;
            ViewBag.stockOut = lst.GroupBy(x => x.Product.ProductId)
                               .Select(g => new StockOutDTO
            {
                Quantity = g.Sum(c => c.Quantity),
                Product  = g.First().Product
            }).ToList();


            List <StockInDTO> stockIn = repository.GetStockIns().ToList().GroupBy(x => x.Product.ProductId)
                                        .Select(g => new StockInDTO
            {
                Quantity = g.Sum(c => c.Quantity),
                Product  = g.First().Product
            }).ToList();

            ViewBag.StockIn          = stockIn;
            ViewBag.ProductList      = repository.GetProducts().ToList();
            ViewBag.TotalProductSold = lst.Sum(x => x.Quantity);
            ViewBag.ProductSoldlst   = lst.GroupBy(x => x.Product.ProductId)
                                       .Select(g => new StockOutDTO
            {
                Quantity = g.Sum(c => c.Quantity)
            }).Select(x => x.Quantity).ToList();
            ViewBag.NewOrder      = repository.GetOrders().Where(x => x.Date.Day == DateTime.Now.Day).ToList().Count;
            ViewBag.CustomerCount = repository.GetCustomers().Count;
            return(View());
        }
예제 #2
0
        // GET: Order/Edit/5
        public ActionResult Edit(int id)
        {
            MyRepository repository = new MyRepository();

            ViewBag.Customers = repository.GetCustomers().ToList();
            ViewBag.Products  = repository.GetAvailableProducts().ToList();
            return(View(repository.GetOrder(id)));
        }
예제 #3
0
        // GET: Order/Create
        public ActionResult Create()
        {
            MyRepository repository = new MyRepository();

            ViewBag.Customers = repository.GetCustomers().ToList();
            ViewBag.Products  = repository.GetAvailableProducts().ToList();
            return(View());
        }