Example #1
0
        public RestfulResult All(BrandAllRequest request)
        {
            if (String.IsNullOrEmpty(request.Type))
            {
                return(new RestfulResult {
                    Data = _brandDataService.GetAll(request)
                });
            }

            if (request.Type.ToLower() == "refresh")
            {
                return(Refresh(new BrandRefreshRequest
                {
                    Refreshts = request.Refreshts
                }));
            }

            return(new RestfulResult {
                Data = _brandDataService.GetAll(request)
            });
        }
Example #2
0
        private List <BrandInfoResponse> GetBrand(CouponInfoResponse couponInfo)
        {
            if (couponInfo.ProductInfoResponse != null)
            {
                if (couponInfo.ProductInfoResponse.BrandInfoResponse != null)
                {
                    return(new List <BrandInfoResponse>(1)
                    {
                        couponInfo.ProductInfoResponse.BrandInfoResponse
                    });
                }
            }

            if (couponInfo.PromotionInfoResponse != null)
            {
                if (couponInfo.PromotionInfoResponse.BrandIds != null &&
                    couponInfo.PromotionInfoResponse.BrandIds.Count > 0)
                {
                    var t = _brandDataService.GetAll(new BrandAllRequest
                    {
                        Refreshts = DateTime.Now
                    });

                    if (t.IsSuccess && t.Data != null && t.Data.Count > 0)
                    {
                        var b = t.Data.Where(v => couponInfo.PromotionInfoResponse.BrandIds.Any(s => s == v.Id)).ToList();

                        if (b.Count > 0)
                        {
                            return(b);
                        }
                    }
                }
            }

            return(new List <BrandInfoResponse>(0));
        }