예제 #1
0
        public async Task <Offer> AssignOffer(OfferType offerType, IOfferValueCalculator offerValueCalculator)
        {
            var value = await offerValueCalculator.Calculate(this, offerType);

            var offer = new Offer(this, offerType, value);

            _assignedOffers.Add(offer);

            NumberOfActiveOffers++;

            return(offer);
        }
 public OfferAssignmentService(
     IMemberRepository memberRepository,
     IOfferTypeRepository offerTypeRepository,
     IOfferValueCalculator offerValueCalculator,
     IOfferRepository offerRepository
     )
 {
     _memberRepository = memberRepository;
     _offerTypeRepository = offerTypeRepository;
     _offerValueCalculator = offerValueCalculator;
     _offerRepository = offerRepository;
 }
예제 #3
0
 public OfferAssignmentService(
     IMemberRepository memberRepository,
     IOfferTypeRepository offerTypeRepository,
     IOfferValueCalculator offerValueCalculator,
     IOfferRepository offerRepository
     )
 {
     _memberRepository     = memberRepository;
     _offerTypeRepository  = offerTypeRepository;
     _offerValueCalculator = offerValueCalculator;
     _offerRepository      = offerRepository;
 }
예제 #4
0
        public Offer AssignOffer(OfferType offerType, IOfferValueCalculator valueCalculator)
        {
            DateTime dateExpiring = offerType.CalculateExpirationDate();
            int      value        = valueCalculator.CalculateValue(this, offerType);

            var offer = new Offer(this, offerType, dateExpiring, value);

            _assignedOffers.Add(offer);

            NumberOfActiveOffers++;

            return(offer);
        }
예제 #5
0
        public Offer AssignOffer(OfferType offerType, IOfferValueCalculator valueCalculator)
        {
            DateTime dateExpiring = offerType.CalculateExpirationDate();
            int value = valueCalculator.CalculateValue(this, offerType);

            var offer = new Offer(this, offerType, dateExpiring, value);

            _assignedOffers.Add(offer);

            NumberOfActiveOffers++;

            return offer;
        }
예제 #6
0
        public Offer AssignOffer(OfferType offerType,
            IOfferValueCalculator offerValueCalulator)
        {
            var value = offerValueCalulator.CalculateValue(this, offerType);

            var dateExpiring = offerType.ExpirationType.GetDateExpiring(offerType);

            var offer = new Offer(this, offerType, dateExpiring, value);

            _assignedOffers.Add(offer);
            NumberOfActiveOffers++;

            return offer;
        }
예제 #7
0
        public Offer AssignOffer(OfferType offerType,
                                 IOfferValueCalculator offerValueCalulator)
        {
            var value = offerValueCalulator.CalculateValue(this, offerType);

            var dateExpiring = offerType.ExpirationType.GetDateExpiring(offerType);

            var offer = new Offer(this, offerType, dateExpiring, value);

            _assignedOffers.Add(offer);
            NumberOfActiveOffers++;

            return(offer);
        }
예제 #8
0
 public AssignOfferHandler(
     AppDbContext appDbContext, IOfferValueCalculator offerValueCalculator)
 {
     _appDbContext         = appDbContext;
     _offerValueCalculator = offerValueCalculator;
 }