public ActionResult BrandType(long id) { BrandTypeViewModel viewModel = new BrandTypeViewModel(); // 次分類列表 viewModel.brandSubTypeList = _brandSubTypeRepository.GetList(id, false); // 品牌列表 viewModel.brandList = _brandRepository.GetList(id, 0, false); return PartialView(viewModel); }
public ActionResult BrandType(long id) { BrandTypeViewModel viewModel = new BrandTypeViewModel(); // 次分類列表 viewModel.brandSubTypeList = _brandSubTypeRepository.GetList(id, false); // 品牌列表 viewModel.brandList = _brandRepository.GetList(id, 0, false); return(PartialView(viewModel)); }
public BrandTypeViewModel GetBrandType(int id) { var brandType = this.DbContext .BrandTypes .Include(x => x.Brands) .FirstOrDefault(x => x.Id == id); if (brandType == null) { return(null); } var brandTypeModel = new BrandTypeViewModel() { BrandTypeName = brandType.TypeName, Brands = this.Mapper.Map <ICollection <BrandConciseViewModel> >(brandType.Brands) }; return(brandTypeModel); }