コード例 #1
0
        public IActionResult EditStoreProduct(int storeId, int productId)
        {
            var storeProduct = _localService.GetStoreProduct(storeId, productId);
            var templates    = _commonService.GetShipmentTemplate();

            if (!templates.Any())
            {
                templates = _n11Service.GetShipmentTemplates();
                _commonService.SaveShipmentTemplates(templates);
            }
            var model = new EditStoreProductModel
            {
                StoreProduct      = storeProduct,
                ShipmentTemplates = templates,
                AttributesQuery   = storeProduct.attribute_query
            };

            if (storeProduct.Product?.ProductCategories?.Any() ?? false)
            {
                var category = storeProduct.Product.ProductCategories.First().Category;
                model.CategoryAttributes = _localService.GetCategoryOptions(category.category_id, storeId).OrderByDescending(co => co.IsRequired).ToList();
                model.CategoryName       = category.path_name;
            }
            return(PartialView("_EditStoreProduct", model));
        }