Пример #1
0
        private static List <Event> UpcomingEvents()
        {
            var db        = new ApplicationDbContext();
            var allEvents = (from e in db.Events
                             select e).Include("Attendees");

            var upcoming = new List <Event>();

            foreach (Event e in allEvents)
            {
                var willSend = new SMSNotificationPolicy(e).NeedsToBeSent(DateTime.Now);
                if (willSend)
                {
                    upcoming.Add(e);
                }
            }

            return(upcoming);
        }
Пример #2
0
        private static List<Event> UpcomingEvents()
        {
            var db = new ApplicationDbContext();
            var allEvents = (from e in db.Events
                            select e).Include("Attendees");

            var upcoming = new List<Event>();

            foreach(Event e in allEvents)
            {
                var willSend = new SMSNotificationPolicy(e).NeedsToBeSent(DateTime.Now);
                if (willSend)
                {
                    upcoming.Add(e);
                }
            }

            return upcoming;
        }