using FluentScheduler; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sevomin.Models.Helpers.ScheduledTasks { public class NewApplication : ITask { public async void Execute() { var avalins = SevominDbContext.Current.DovominJobs.Where(dj => dj.ApplyDate.Date == DateTime.Now.AddDays(-2).Date).Select(a => a.Job.Avalin); foreach (var avalin in avalins.Distinct()) { SevominEmailer emailer = new SevominEmailer(); emailer.EmailType = EmailType.NewApplication; emailer.Parameters.Add("", ""); await emailer.SendAsync(avalin.Email, "", true); } } } }