Example #1
0
 /// <summary>
 /// Get product have product variation inside
 /// </summary>
 /// <param name="products">Product List</param>
 /// <returns>ProductModel List</returns>
 public IList <ProductModel> GetProducts(IList <Product> products)
 {
     return(products.Select(x => new ProductModel
     {
         Id = x.Id,
         ProductName = x.Name,
         ProductImage = x.ImagePath,
         proVarationViewModels = GetProductVariations(
             _productVariationService.GetProductVariations(x.Id)).ToList(),
     }).ToList());
 }
 public ActionResult DetailProduct(Guid id)
 {
     try
     {
         var product = _productService.GetById(id);
         var model   = new ProductViewModel
         {
             Id     = product.Id,
             Name   = product.Name,
             Brand  = _brandService.GetById(product.Brand_Id),
             Vendor = _vendorService.GetById(product.Vendor_Id),
             ProVa  = GetProductVariations(
                 _productVariationService.GetProductVariations(product.Id)).ToList(),
             Description = product.Description,
             ImagePath   = product.ImagePath,
             CreatedDate = product.CreatedDate,
             UpdateDate  = product.UpdatedDate,
             IsActive    = product.IsActive
         };
         return(View(model));
     }
     catch { return(RedirectToAction("Erorr500", "HomdeAdmin")); }
 }