Exemplo n.º 1
0
 public void Add()
 {
     using (EmailListDbContext db = new EmailListDbContext())
     {
         try
         {
             EmailList emaillist = new EmailList()
             {
                 List_Name = listname,
                 List_Dtls = listdetails,
                 Eml_Id    = emailid,
                 Emlist_Id = emaillistid,
                 U_Id      = userid
             };
             db.EmailLists.Add(emaillist);
             db.SaveChangesAsync();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }
Exemplo n.º 2
0
 public void Delete()
 {
     using (EmailListDbContext db = new EmailListDbContext())
     {
         try
         {
             EmailList emaillist = db.EmailLists.Where(x => x.U_Id == userid && x.Emlist_Id == emaillistid).FirstOrDefault();
             db.EmailLists.Remove(emaillist);
             db.SaveChangesAsync();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }