Beispiel #1
0
 public int CreateEmail(Emails email)
 {
     if (_dataContext.Emails.Contains(email))
     {
         Console.WriteLine("Here!");
         _dataContext.SubmitChanges();
         return(email.Id);
     }
     _dataContext.Emails.InsertOnSubmit(email);
     _dataContext.SubmitChanges();
     return(email.Id);
 }
Beispiel #2
0
 /// <summary>
 /// Добавить нового получателя
 /// </summary>
 public string CreateEmail(Emails email)
 {
     try
     {
         emailsDataContext.Emails.InsertOnSubmit(email);
         emailsDataContext.SubmitChanges();
         return(email.Email);
     }
     catch (System.Data.Linq.DuplicateKeyException ex)
     {
         return(ex.Message);
     }
 }
 public int CreateEmail(Emails email)
 {
     if (_dataContext.Emails.Contains(email))
     {
         return(email.Id);
     }
     _dataContext.Emails.InsertOnSubmit(email);
     _dataContext.SubmitChanges();
     return(email.Id);
 }
 public int CreateEmail(Email email)
 {
     context.EmailsTable.InsertOnSubmit(email);
     context.SubmitChanges();
     return(email.Id);
 }