public void CreateNewsletter(string name, string html) { IEnumerable <Subscription> subscriptions = SubscriptionRepository.Get(s => s.IsConfirmed == true, null, null); Newsletter newsletter = new Newsletter(); newsletter.Name = name; newsletter.DateCreated = DateTime.UtcNow; newsletter.Html = html; newsletter.InProcess = false; foreach (Subscription s in subscriptions) { NewsletterTask newslettertask = new NewsletterTask(); newslettertask.SetNewsletter(newsletter); newslettertask.SetSubscription(s); newsletter.AddNewsletterTask(newslettertask); } NewsletterRepository.Insert(newsletter); NewsletterRepository.UnitOfWork.Commit(); }
/// <summary> /// Update NewsletterTask from context /// </summary> /// <param name="task"></param> public void UpdateNewsletterTask(NewsletterTask task) { currentunitofwork.SetModified <NewsletterTask>(task); }
/// <summary> /// Delete NewsletterTask from context /// </summary> /// <param name="task"></param> public void DeleteNewsletterTask(NewsletterTask task) { currentunitofwork.Set <NewsletterTask>().Remove(task); }
public void UpdateNewsletterTask(NewsletterTask task) { NewsletterRepository.UpdateNewsletterTask(task); NewsletterRepository.UnitOfWork.Commit(); }