Beispiel #1
0
        public ActionResult Count()
        {
            string storeName       = string.Empty;
            string locationName    = string.Empty;
            string maxCapacity     = string.Empty;
            string currentCapacity = string.Empty;

            int storeId    = (int)Session["StoreId"];
            int locationId = (int)Session["LocationId"];

            using (var shopSafeEntity = new ShopSafeEntities())
            {
                var storeEntity             = shopSafeEntity.Stores.Where(s => s.Id == storeId).FirstOrDefault();
                var locationEntity          = shopSafeEntity.Locations.Where(l => l.Id == locationId).FirstOrDefault();
                var userStoreLocationEntity = shopSafeEntity.Store_Location.Where(i => i.Store_Id == storeId && i.Location_Id == locationId).FirstOrDefault();


                storeName       = storeEntity.Name;
                locationName    = locationEntity.Name;
                maxCapacity     = (userStoreLocationEntity.Capacity_Id * 10).ToString();
                currentCapacity = userStoreLocationEntity.Current_Capacity.ToString();
            }

            ViewBag.Store           = storeName;
            ViewBag.Location        = locationName;
            ViewBag.MaxCapacity     = maxCapacity;
            ViewBag.CurrentCapacity = currentCapacity;

            return(View());
        }
Beispiel #2
0
        public ActionResult Index()
        {
            SelectVM model = new SelectVM();

            using (var shopSafeEntity = new ShopSafeEntities())
            {
                var stores    = shopSafeEntity.Stores.ToList();
                var locations = shopSafeEntity.Locations.ToList();

                model.Stores    = stores;
                model.Locations = locations;
            }

            return(View(model));
        }