コード例 #1
0
        public ActionResult ProductSpeacialAreaAdd()
        {
            string[] SID = HttpContext.Request.Form.GetValues(0);
            string[] PID = HttpContext.Request.Form.GetValues(1);
            ProductSpecialAreaModel productSpecialAreaModel = new ProductSpecialAreaModel
            {
                SpecialAreaID = int.Parse(SID[0]),
                ProductID     = int.Parse(PID[0])
            };

            if (!ModelState.IsValid)
            {
                return(View());
            }


            GetProductSpecialAreaResponse getProductSpecialAreaResponse = WebApiOperation.SendPost <B_Commerce.SMVC.Areas.Admin.Models.ProductSpecialAreaModel, GetProductSpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_PRODUCT_SPECIAL_AREA_ADD, productSpecialAreaModel);

            if (getProductSpecialAreaResponse.Code == 0)
            {
                ViewBag.error = MyResource.Resource.General_Success;
                return(RedirectToAction("SpecialAreaProduct", "Product"));
            }
            ViewBag.error = getProductSpecialAreaResponse.Message;
            return(RedirectToAction("Error", "Home"));
        }
コード例 #2
0
        public ActionResult SpecialAreaProduct()
        {
            SpecialAreaResponse specialAreaResponse = WebApiOperation.SendPost <object, SpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETSPECIAL_AREA, null);
            GetProductRequest   request             = new GetProductRequest
            {
                CategoryID = 0,
                Page       = 1,
                Range      = 20,
                BrandID    = 0,
                Color      = ""
            };


            ProductModelResponse productModelResponse = WebApiOperation.SendPost <GetProductRequest, ProductModelResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GETPRODUCTS, request);

            GetProductSpecialAreaResponse getProductSpecialAreaResponse = WebApiOperation.SendPost <string, GetProductSpecialAreaResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_GET_PRODUCT_SPECIAL_AREA, "");


            if (productModelResponse.Code == Constants.LOGIN_RESPONSE_SUCCESS)
            {
                specialAreaResponse.productModels.AddRange(productModelResponse.Products);
            }
            if (getProductSpecialAreaResponse.Code == Constants.LOGIN_RESPONSE_SUCCESS)
            {
                specialAreaResponse.productSpecialAreaModels.AddRange(getProductSpecialAreaResponse.ProductSpecialAreaModels);
            }


            if (specialAreaResponse.Code != 0)
            {
                ViewBag.error = specialAreaResponse.Message;
                return(View());
            }

            return(View(specialAreaResponse));
        }