コード例 #1
0
        public IActionResult UpdateProduct(int productTypeId, short productAttributesNumber = 3)
        {
            SellerView seller = loginPersistence.PersistLogin();

            var             errors      = new List <string>();
            ProductTypeView productType = eCommerce.GetProductTypeBy(productTypeId);

            if (productType == null)
            {
                errors.Add("Could not found product type");
            }

            if (errors.Any())
            {
                ViewData[GlobalViewBagKeys.Errors] = errors;
                return(RedirectToAction("Product"));
            }

            ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce;
            return(View(new UpdateProductViewModel
            {
                ProductTypeId = productTypeId,
                UpdateModel = eCommerce.GetProductUpdateModelBy(int.Parse(seller.Id), productTypeId),
                ProductAttributesNumber = productAttributesNumber
            }));
        }