Ejemplo n.º 1
0
 public void Update()
 {
     using (EmailListDbContext db = new EmailListDbContext())
     {
         EmailList emaillist = db.EmailLists.Where(x => x.U_Id == userid && x.Emlist_Id == emaillistid).FirstOrDefault();
         try
         {
             if (listname != emaillist.List_Name)
             {
                 emaillist.List_Name = listname;
             }
             else if (listdetails != emaillist.List_Dtls)
             {
                 emaillist.List_Dtls = listdetails;
             }
             else if (emailid != emaillist.Eml_Id)
             {
                 emaillist.Eml_Id = emailid;
             }
             db.SaveChanges();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }
Ejemplo n.º 2
0
 public void Update()
 {
     using (EmailDbContext db = new EmailDbContext())
     {
         Email email = db.Emails.Where(x => x.U_Id == userid && x.Eml_Id == emailid).FirstOrDefault();
         try
         {
             if (firstname != email.F_Name)
             {
                 email.F_Name = firstname;
             }
             else if (lastname != email.L_Name)
             {
                 email.L_Name = lastname;
             }
             else if (emailaddress != "")
             {
                 email.Email_Add = emailaddress;
             }
             db.SaveChanges();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }
Ejemplo n.º 3
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());
         }
     }
 }
Ejemplo n.º 4
0
 public void Add()
 {
     using (EmailDbContext db = new EmailDbContext())
     {
         try
         {
             Email email = new Email()
             {
                 F_Name    = firstname,
                 L_Name    = lastname,
                 Email_Add = emailaddress,
                 Eml_Id    = emailid,
                 U_Id      = userid
             };
             db.Emails.Add(email);
             db.SaveChangesAsync();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }
Ejemplo n.º 5
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());
         }
     }
 }