示例#1
0
        public ActionResult Sell()
        {
            int EmployeeId = (int)Session.Contents["EmployeeId"];
            var m = new _5Bites.Models.Store_.Sell.ViewModel();

            using (var db = new dbEntities())
            {
                var ss = db.EmployeeStores.Where(es => es.EmployeeId == EmployeeId).Select(es => es.Store);
                foreach (var s in ss)
                {
                    var sm = new Models.Store_.Sell.StoreModel();
                    sm.Id = s.Id;
                    sm.Bank = s.Bank;
                    sm.Name = s.Location.Name;
                    foreach (var i in s.Location.Inventories)
                    {
                        var pm = new Models.Store_.Sell.ProductModel();
                        pm.Id = i.Product.Id;
                        pm.Description = i.Product.Name;
                        pm.Price = i.Product.RetailPrice;
                        pm.Quantity = i.Quantity;
                        sm.Inventory.Add(pm);
                    }
                    m.Stores.Add(sm);
                }
            }

            return View(m);
        }
示例#2
0
        public ActionResult Sell()
        {
            int EmployeeId = (int)Session.Contents["EmployeeId"];
            var m          = new _5Bites.Models.Store_.Sell.ViewModel();

            using (var db = new dbEntities())
            {
                var ss = db.EmployeeStores.Where(es => es.EmployeeId == EmployeeId).Select(es => es.Store);
                foreach (var s in ss)
                {
                    var sm = new Models.Store_.Sell.StoreModel();
                    sm.Id   = s.Id;
                    sm.Bank = s.Bank;
                    sm.Name = s.Location.Name;
                    foreach (var i in s.Location.Inventories)
                    {
                        var pm = new Models.Store_.Sell.ProductModel();
                        pm.Id          = i.Product.Id;
                        pm.Description = i.Product.Name;
                        pm.Price       = i.Product.RetailPrice;
                        pm.Quantity    = i.Quantity;
                        sm.Inventory.Add(pm);
                    }
                    m.Stores.Add(sm);
                }
            }

            return(View(m));
        }