public void SendDigest(int userId) { try { var user = _db.Users.Find(userId); if (user.TsMailDigest.AddDays(user.DigestDaysSpan) < DateTime.UtcNow) { var services = new List<IDigestService> { new NewsSrv(), new DiscussionSrv(), //new BlogSrv(), new EventSrv(), //new JobSrv(), //new MentorSrv(), //new MessageSrv(), }; var userSrv = new UserDigest(userId, services); MailSrv.SendNewsletterAsync(user, userSrv.GetDigest(), "NITCAA Newsletter", null); //user.TsMailDigest = DateTime.UtcNow; //UpdateUser(user); } } catch (Exception ex) { AddLog(userId + "#SendDigest-Failure#" + ex.Message, LogTypes.Error, "Server"); } }
public void SendDigest(int userId) { try { var user = _db.Users.Find(userId); if (user.TsMailDigest.AddDays(user.DigestDaysSpan) < DateTime.UtcNow) { var services = new List <IDigestService> { new NewsSrv(), new DiscussionSrv(), //new BlogSrv(), new EventSrv(), //new JobSrv(), //new MentorSrv(), //new MessageSrv(), }; var userSrv = new UserDigest(userId, services); MailSrv.SendNewsletterAsync(user, userSrv.GetDigest(), "NITCAA Newsletter", null); //user.TsMailDigest = DateTime.UtcNow; //UpdateUser(user); } } catch (Exception ex) { AddLog(userId + "#SendDigest-Failure#" + ex.Message, LogTypes.Error, "Server"); } }