public void SaveMailRecord(List<string> addresses, string subject, string body)
        {
            MailRecord m = new MailRecord();

            dc = new DataContext();

            m.MailAddresses = addresses;
            m.Subject = subject;
            m.Body = body;
            dc.MailRecords.Add(m);
            dc.SaveChanges();

            IEnumerable<MailRecord> tempmails = dc.MailRecords.AsEnumerable<MailRecord>();
            int recid = tempmails.Last<MailRecord>().ID;

            foreach (var ms in addresses)
            {
                addMails(ms, recid);
            }
        }
 public RepositoryBase()
 {
     ds = new DataContext();
     ds.Configuration.ProxyCreationEnabled = false;
 }