/// <summary> /// جزئیات محصول /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> ProductDetail(int id) { var model = await _productRepository.GetProductDetail(id); if (model == null) { return(NotFound()); } ViewBag.Gallery = await _productGalleryRepository.GetListGalleryByProductId(id); List <ProductFeature> features = await _productFeatureRepository.GetFeaturesByProductId(id); ViewBag.Features = features; List <int> featuresWithSSOTType = _productFeatureRepository.FeaturesWithSSOTType(features); if (featuresWithSSOTType != null && featuresWithSSOTType.Count > 0) { ViewBag.FeatureSSOTValue = await _featureItemRepository.TableNoTracking.Where(x => featuresWithSSOTType.Contains(x.FeatureId)).ToListAsync(); } ViewBag.Unit = await _productUnitRepository.GetListAsync(); var test = configuration.GetSection(nameof(SiteSettings)).Get <SiteSettings>(); ViewBag.Url = test.SiteConfig.UrlAddress; ViewBag.RelatedProducts = _productRepository.GetList(a => a.ProductGroupId == model.ProductGroupId && a.Id != model.Id && !a.IsDeleted, o => o.OrderByDescending(a => a.CreateDate)).Take(12).ToList(); return(View(model)); }
/// <summary> /// جزئیات محصول /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> ProductDetail(int id) { var model = await _productRepository.GetProductDetail(id); if (model == null) { return(NotFound()); } ViewBag.Gallery = await _productGalleryRepository.GetListGalleryByProductId(id); List <ProductFeature> features = await _productFeatureRepository.GetFeaturesByProductId(id); ViewBag.Features = features; List <int> featuresWithSSOTType = _productFeatureRepository.FeaturesWithSSOTType(features); if (featuresWithSSOTType != null && featuresWithSSOTType.Count > 0) { ViewBag.FeatureSSOTValue = await _featureItemRepository.TableNoTracking.Where(x => featuresWithSSOTType.Contains(x.FeatureId)).ToListAsync(); } var test = configuration.GetSection(nameof(SiteSettings)).Get <SiteSettings>(); ViewBag.Url = test.SiteConfig.UrlAddress; return(View(model)); }