public Campaign AddEmailsToCampaign(Campaign campaign, List<Email> emails)
 {
     foreach (Email e in emails)
     {
         EmailCampaign ec = new EmailCampaign();
         ec.EmailID = e.ID;
         ec.CampaignID = campaign.ID;
         ec.LastSendDate = DateTime.Now;
         ec.CreateDate = DateTime.Now;
         _dbContext.EmailCampaigns.AddObject(ec);
         _dbContext.SaveChanges();
     }
     return campaign;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the EmailCampaigns EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEmailCampaigns(EmailCampaign emailCampaign)
 {
     base.AddObject("EmailCampaigns", emailCampaign);
 }
 /// <summary>
 /// Create a new EmailCampaign object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="campaignID">Initial value of the CampaignID property.</param>
 /// <param name="emailID">Initial value of the EmailID property.</param>
 /// <param name="lastSendDate">Initial value of the LastSendDate property.</param>
 /// <param name="statusID">Initial value of the StatusID property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 public static EmailCampaign CreateEmailCampaign(global::System.Int32 id, global::System.Int32 campaignID, global::System.Int32 emailID, global::System.DateTime lastSendDate, global::System.Int32 statusID, global::System.DateTime createDate)
 {
     EmailCampaign emailCampaign = new EmailCampaign();
     emailCampaign.ID = id;
     emailCampaign.CampaignID = campaignID;
     emailCampaign.EmailID = emailID;
     emailCampaign.LastSendDate = lastSendDate;
     emailCampaign.StatusID = statusID;
     emailCampaign.CreateDate = createDate;
     return emailCampaign;
 }