예제 #1
0
        public ActionResult CategoryList()
        {
            Category[] categories = _categoryService.GetAll();

            var categoryListViewModel = new CategoryListViewModel(categories);

            return View("CategoryList", categoryListViewModel);
        }
예제 #2
0
        public IndexViewModel(Category[] categories, Lesson[] lessons)
        {
            CategoryList = new CategoryListViewModel(categories);
            LessonLists = new LessonListViewModel[categories.Length];

            for (int i = 0; i < categories.Length; i++)
            {
                LessonLists[i] = new LessonListViewModel
                (
                    lessons.Where(les => les.CategoryId == categories[i].Id).ToArray(),
                    categories[i].Name
                );
            }
        }