Exemple #1
0
        public IEnumerable <EventListingModel> All(int page = 1)
        {
            var events = this.db.Events;
            var result = new List <EventListingModel>();
            var count  = 1;

            foreach (var event_ in events)
            {
                // TODO
                var newEvent = new EventListingModel
                {
                    Count          = count,
                    Name           = event_.Name,
                    Start          = event_.Start,
                    End            = event_.End,
                    PricePerTicket = event_.PricePerTicket,
                    TotalTickets   = event_.TotalTickets
                };

                result.Add(newEvent);
                count++;
            }

            return(result
                   .Skip((page - 1) * WebConstants.EventsPageSize)
                   .Take(WebConstants.EventsPageSize));
        }
Exemple #2
0
        public void TestEvent(int amount, string total)
        {
            var buy5Get20Percent = new NextItemDiscount("Buy 5, Get 20% off the 5th experience",
                                                        "Buy 5, Get 20% off the 5th experience", (decimal)0.2, 4);

            var orderLine = new EventListingModel
            {
                Event = new Event()
                {
                    Name             = "Wine Tour",
                    ShortDescription = "Wine Tour",
                    Id        = 2,
                    Price     = 440,
                    Discounts = new List <BaseDiscount>
                    {
                        buy5Get20Percent,
                        new NextItemDiscount("Buy 4, ONLY Pay for 3", "Buy 4, ONLY Pay for 3", 1, 3)
                    }
                },
                Amount = amount
            };

            Assert.Equal(total, orderLine.Total);
        }