//Admin Connection view, locate in "DO SHOP project folder -> Views-> Admin"
        //[UserAuthorization(ConnectionPage = "~/Admin/Login", Roles = "Admin")]
        public ActionResult Index()
        {
            // Check if not there are no items,
            var newVar = _itemDistributionControl.GetAllItems();

            if (newVar.Count() == 0)
            {
                // Do something here
                return(View(_itemDistributionControl.GetAllItems()));
            }
            else
            {
                return(View(_itemDistributionControl.GetAllItems()));
            }
        }
Beispiel #2
0
        // GET: The Main Index(Home) Page
        public ActionResult Index()
        {
            var categories = _itemCategoryControl.GetAllCategories();

            var items = (_itemDistributionControl.GetAllItems()).Where(i => i.CategoryId == null).ToList();

            if (items.Count != 0)
            {
                IEnumerable <Category> itemsWithoutCategory = new List <Category> {
                    new Category {
                        Id = 0, Items = items, Name = "Item has no category"
                    }
                };
                categories = categories.Concat(itemsWithoutCategory);
            }
            return(View(categories));
        }