예제 #1
0
        public IEnumerable <Gift> GetGiftsByCriteria(GiftCriteriaBuilder giftCriteria)
        {
            var criteria   = giftCriteria;
            int lowerPrice = criteria.Price.GetLower() * 100;
            int upperPrice = criteria.Price.GetUpper() * 100;
            var gifts      = GetAll().Where(g =>
                                            g.AgeCategory == criteria.Age &&
                                            g.Recipient == criteria.Recipient &&
                                            g.Price >= lowerPrice && g.Price <= upperPrice);

            return(gifts);
        }
예제 #2
0
 public PollStateMachine(IServiceProvider scopeFactory)
 {
     _stateStorage = new Dictionary <string, IState>();
     _scope        = scopeFactory.CreateScope();
     GiftCriteria  = new GiftCriteriaBuilder();
 }