private TopHotListMenuViewModel GetListMenu(string catecode) { TopHotListMenuViewModel model = new TopHotListMenuViewModel(); var category = outDoorMediaCateService.IncludeGetALL().ToList(); foreach (var item in category) { CategoryListViewModel clvm = new CategoryListViewModel(); CategoryViewModel cvm = new CategoryViewModel() { CID = item.CateCode, Name = item.CateName, Selected = catecode.StartsWith(item.CateCode, StringComparison.CurrentCultureIgnoreCase), Url = Url.Action("index", "list", new { category = item.CateCode }) }; clvm.Category = cvm; List<CategoryViewModel> ChildCategories = item.ChildCategoies.Select(x => new CategoryViewModel { CID = x.CateCode, Name = x.CateName, Selected = x.CateCode.Equals(catecode, StringComparison.CurrentCultureIgnoreCase), Url = Url.Action("index", "list", new { category = x.CateCode }) }).ToList(); clvm.ChildCategories = ChildCategories; model.Items.Add(clvm); } return model; }
private TopHotListMenuViewModel GetTopHotListMenu() { TopHotListMenuViewModel model = new TopHotListMenuViewModel(); var category = outDoorMediaCateService.IncludeGetALL().ToList(); foreach (var item in category) { CategoryListViewModel clvm = new CategoryListViewModel(); CategoryViewModel cvm = new CategoryViewModel() { CID = item.CateCode, Name = item.CateName, Url = Url.Action("index", "list", new { category = item.CateCode }) }; clvm.Category = cvm; List<CategoryViewModel> ChildCategories = item.ChildCategoies.Select(x => new CategoryViewModel { CID = x.CateCode, Name = x.CateName, Url = Url.Action("index", "list", new { category = x.CateCode }) }).ToList(); clvm.ChildCategories = ChildCategories; model.Items.Add(clvm); } return model; }