Пример #1
0
        private void PopulateCategoryDropDownList(object selectedCategory = null)
        {
            IEnumerable <Category> categoryQuery;

            using (Repos repo = new Repos())
            {
                categoryQuery = repo.GetCategoryList();
            }
            ViewBag.CategoryId = new SelectList(categoryQuery.Distinct().ToList(), "CategoryId", "CategoryName", selectedCategory);
        }
Пример #2
0
        public ActionResult Index()
        {
            IEnumerable <Category> cats;

            using (Repos repo = new Repos())
            {
                cats = repo.GetCategoryList();
            }

            return(View(cats));
        }