Exemplo n.º 1
0
        public BaseApiResponse GetSpecifications(GetParamsRequest request)
        {
            request.CheckNotNull(nameof(request));

            var specifications = _goodsQueryService.GetPublishedSpecifications(request.Id);

            if (!specifications.Any())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "没有参数"
                });
            }
            return(new GetSpecificationsResponse
            {
                Specifications = specifications.Select(x => new Specification
                {
                    Id = x.Id,
                    Name = x.Name,
                    Value = x.Value,
                    Price = x.Price,
                    OriginalPrice = x.OriginalPrice,
                    Benevolence = x.Benevolence,
                    Number = x.Number,
                    BarCode = x.BarCode,
                    Stock = x.Stock,
                    Thumb = x.Thumb,
                    AvailableQuantity = x.AvailableQuantity
                }).ToList()
            });
        }
Exemplo n.º 2
0
        public BaseApiResponse GetParams(GetParamsRequest request)
        {
            request.CheckNotNull(nameof(request));

            var goodsParams = _goodsQueryService.GetGoodsParams(request.Id);

            if (!goodsParams.Any())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "没有参数"
                });
            }
            return(new GetParamsResponse
            {
                Params = goodsParams.Select(x => new GoodsParam
                {
                    Id = x.Id,
                    Name = x.Name,
                    Value = x.Value
                }).ToList()
            });
        }