private PromotionInfoResponse IsR(PromotionInfoResponse response, UserModel currentAuthUser, int entityId)
        {
            if (response == null || currentAuthUser == null)
            {
                return response;
            }

            //是否收藏
            var favoriteEntity = _favoriteService.Get(currentAuthUser.Id, entityId, SourceType.Promotion);
            if (favoriteEntity != null)
            {
                response.CurrentUserIsFavorited = true;
            }
            //是否获取过优惠码
            var list = _couponService.Get(currentAuthUser.Id, entityId, SourceType.Promotion);
            if (list != null && list.Count > 0)
            {
                response.CurrentUserIsReceived = true;
            }

            return response;
        }
示例#2
0
        public PromotionInfo PromotionInfoMapping(PromotionInfoResponse source)
        {
            if (source == null)
            {
                return null;
            }

            var target = Mapper.Map<PromotionInfoResponse, PromotionInfo>(source);

            return target;
        }
示例#3
0
        private ItemsInfoResponse ItemsInfoResponseMapping(PromotionInfoResponse source)
        {
            var target = Mapper.Map<PromotionInfoResponse, ItemsInfoResponse>(source);

            target.SType = SourceType.Promotion;
            target.Store = source.StoreInfoResponse;
            target.Resources = source.ResourceInfoResponses;

            var info = PromotionInfoMapping(source);
            target.Promotions = new List<PromotionInfo> { info };

            return target;
        }
示例#4
0
        public static CouponCodeResponse CouponCodeResponseMapping(CouponHistoryEntity source, ProductInfoResponse product,
                                                                  PromotionInfoResponse promotion)
        {
            if (source == null)
            {
                return null;
            }

            var target = Mapper.Map<CouponHistoryEntity, CouponCodeResponse>(source);

            var productname = String.Empty;
            var producttype = 0;
            var productid = 0;
            var productDescription = String.Empty;
            if (promotion != null)
            {
                productname = promotion.Name;
                producttype = (int)SourceType.Promotion;
                productid = promotion.Id;
                productDescription =
                promotion.Description;
            }
            else
            {
                if (product != null)
                {
                    productname = product.Name;
                    producttype = (int)SourceType.Product;
                    productid = product.Id;
                    productDescription =
                    product.Description;
                }
            }

            target.ProductId = productid;
            target.ProductName = productname;
            target.ProductType = producttype;
            target.ProductDescription = productDescription;

            return target;
        }