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