Пример #1
0
        private IEnumerable <SelectListItem> GetCategoriesDropDownList()
        {
            IEnumerable <DropDownCategoryDto> categories     = categories = categoryService.GetCategories();
            List <SelectListItem>             categoriesList = (from cat in categories
                                                                orderby cat.CategoryName
                                                                select new SelectListItem
            {
                Text = cat.CategoryName,
                Value = $"{cat.CategoryID}"
            }).ToList();

            return(categoriesList);
        }
Пример #2
0
        private IEnumerable <CategoryModel> GetCategories(int pageNo)
        {
            IEnumerable <DropDownCategoryDto> categories = service.GetCategories(RecordsPerPage, pageNo);

            return(Mapper.Map <IEnumerable <DropDownCategoryDto>, IEnumerable <CategoryModel> >(categories));
        }