Esempio n. 1
0
        public ICampaign Resolve(CampaignTypes campaignType)
        {
            var campaign = _campaigns.FirstOrDefault(p => p.CampaignTypes == campaignType);

            if (campaign is null)
            {
                throw new ArgumentNullException(nameof(campaignType));
            }

            return(campaign);
        }
Esempio n. 2
0
        public ICampaign Get(Category.Category category, double campaignValue, int minProductQuantity, CampaignTypes campaignTypes)
        {
            ICampaign campaign = null;

            switch (campaignTypes)
            {
            case CampaignTypes.Amount:
                campaign = new AmountCampaign(category, campaignValue, minProductQuantity);
                break;

            case CampaignTypes.Rate:
                campaign = new RateCampaign(category, campaignValue, minProductQuantity);
                break;
            }

            return(campaign);
        }
Esempio n. 3
0
 public IQueryable <CampaignType> GetCampaignTypes() => CampaignTypes.AsNoTracking();