Esempio n. 1
0
        public ActionResult GetProduct(int id)
        {
            Product_Info product = _productManager.GetProduct(id);

            if (product == null)
            {
                return(FailedResult("指定的数据不存在。"));
            }

            Product_InfoDto productDto = Mapper.Map <Product_InfoDto>(product);

            return(DataResult(productDto));
        }
Esempio n. 2
0
        public ActionResult CreateProduct()
        {
            Product_InfoDto args = RequestArgs <Product_InfoDto>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            Product_Info product = Mapper.Map <Product_Info>(args);

            NormalResult result = _productManager.CreateProduct(product, args.catalog_idList, args.attribute_idList);

            return(ApiResult(result.Successful, result.Message));
        }
Esempio n. 3
0
        public ActionResult UpdateProduct()
        {
            Product_InfoDto args = RequestArgs <Product_InfoDto>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            args.summary = args.summary.Replace("\n", @"\r\n");

            Product_Info product = Mapper.Map <Product_Info>(args);

            NormalResult result = _productManager.UpdateProduct(product, args.catalog_idList, args.attribute_idList);

            return(ApiResult(result.Successful, result.Message));
        }