Beispiel #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;
 }
Beispiel #3
0
 public OfferAssignmentService(
     IMemberRepository memberRepository,
     IOfferTypeRepository offerTypeRepository,
     IOfferValueCalculator offerValueCalculator,
     IOfferRepository offerRepository
     )
 {
     _memberRepository     = memberRepository;
     _offerTypeRepository  = offerTypeRepository;
     _offerValueCalculator = offerValueCalculator;
     _offerRepository      = offerRepository;
 }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #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);
        }
 public AssignOfferHandler(
     AppDbContext appDbContext, IOfferValueCalculator offerValueCalculator)
 {
     _appDbContext         = appDbContext;
     _offerValueCalculator = offerValueCalculator;
 }