Example #1
0
        public ActionResult AddOrEditProductVariation(Guid?id)
        {
            try
            {
                var model = new ProVarationViewModel();

                model.DropDownProduct = DropDownListDomain.DropDownList_Product(_productService.SelectAll());
                model.DropDownVolume  = DropDownListDomain.DropDownList_Volume();

                if (id.HasValue)
                {
                    var productVariation = _productVariationService.GetById(id.Value);

                    model = ConvertDomainToModel.ConvertModelFromDomainToProVa(productVariation);

                    model.DropDownProduct = DropDownListDomain.DropDownList_Product(_productService.SelectAll());
                    model.DropDownVolume  = DropDownListDomain.DropDownList_Volume();

                    model.Image = _productImageService.GetProductImage(model.Id) == null ? null :
                                  ConvertDomainToModel.GetProductImage(_productImageService.GetProductImage(model.Id));

                    return(View(model));
                }
                else
                {
                    return(View(model));
                }
            }
            catch { return(RedirectToAction("Erorr500", "HomdeAdmin")); }
        }
Example #2
0
 private IList <ProductsModel> GetProducts(IList <ProductVariation> products)
 {
     return(products.Select(x => new ProductsModel
     {
         Id = x.Id,
         Name = _productService.GetById(x.Product_Id).Name,
         Price = x.Price,
         DiscountPrice = x.DiscountPrice,
         ImagePath = _productImageService.GetProductImage(x.Id).ImagePath,
     }).ToList());
 }
Example #3
0
        public IQueryable <ProductImageItem> GetProductImage(int id)
        {
            var productImage = _ProductImageService.GetProductImage(id);

            return(productImage);
        }