コード例 #1
0
ファイル: GoodsController.cs プロジェクト: 080779/USystem
        public async Task <ApiResult> Detail(GoodsDetailModel model)
        {
            string parm = await settingService.GetParmByNameAsync("网站域名");

            GoodsDTO dto = await goodsService.GetModelAsync(model.Id);

            GoodsImgSearchResult result = await goodsImgService.GetModelListAsync(dto.Id, null, null, null, 1, 100);

            GoodsDetailApiModel apiModel = new GoodsDetailApiModel();

            apiModel.goodsImgs = result.GoodsImgs.Select(g => new GoodsImg {
                id = g.Id, imgUrl = parm + g.ImgUrl
            }).ToList();
            if (dto != null)
            {
                apiModel.id           = dto.Id;
                apiModel.description  = dto.Description.Replace("/upload/", parm + "/upload/");
                apiModel.inventory    = dto.Inventory;
                apiModel.name         = dto.Name;
                apiModel.price        = dto.Price;
                apiModel.realityPrice = dto.RealityPrice;
                apiModel.saleNum      = dto.SaleNum;
            }
            return(new ApiResult {
                status = 1, data = apiModel
            });
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: fangliu520/Beeant
        /// <summary>
        /// 得到产品图片
        /// </summary>
        public virtual ActionResult GoodsDetail(long goodsId, long productId)
        {
            var model = new GoodsDetailModel
            {
                GoodsDetail     = GetGoodsDetail(goodsId, productId),
                GoodsProperties = GetGoodsProperties(goodsId, productId)
            };

            return(View("~/Views/Home/_GoodsDetail.cshtml", model));
        }