public ActionResult CategoryList() { Category[] categories = _categoryService.GetAll(); var categoryListViewModel = new CategoryListViewModel(categories); return View("CategoryList", categoryListViewModel); }
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 ); } }