Exemplo n.º 1
0
        public void Execute(IJobExecutionContext context)
        {
            GymContext db = new GymContext();

            var athletes = db.Athletes.ToList();

            foreach (var athlete in athletes)
            {
                #region Class Reminders
                TimeSpan fullDay = new TimeSpan(1, 0, 0, 0, 0);
                TimeSpan noTime = new TimeSpan(0, 0, 0);

                List<Class> classesToRemind = athlete.Reminders.Reminders.Where(c => c.Time - DateTime.Now <= fullDay && c.Time - DateTime.Now >= noTime).ToList();

                foreach(var cls in classesToRemind)
                {
                    SendClassReminder(athlete.EmailAddress, cls);
                    athlete.Reminders.Reminders.Remove(cls);
                }

                db.SaveChanges();
                #endregion
            }
        }
Exemplo n.º 2
0
 public WODController(GymContext context)
 {
     db = context;
 }
Exemplo n.º 3
0
 public SingleClassSetupsController(GymContext context)
 {
     db = context;
 }
Exemplo n.º 4
0
 public HomeController(GymContext context)
 {
     db = context;
 }
Exemplo n.º 5
0
 public AthletesController(GymContext db, IEmailSender emailSender, UserManager<ApplicationUser> userManager)
 {
     _db = db;
     _emailSender = emailSender;
     _userManager = userManager;
 }
Exemplo n.º 6
0
 public WeeklyClassSetupsController(GymContext context, ICalendarGenerator calendarGenerator)
 {
     db = context;
     _calendarGenerator = calendarGenerator;
 }
Exemplo n.º 7
0
 public PerformancesController(GymContext context)
 {
     db = context;
 }
Exemplo n.º 8
0
 public SubscriptionsController(GymContext db)
 {
     _db = db;
 }