Beispiel #1
0
 internal static void DeleteNewsletter(Newsletters newsletter)
 {
     try
     {
         using (Vicdude_NewsletterEntities db = new Vicdude_NewsletterEntities())
         {
             newsletter.IsDeleted       = true;
             db.Entry(newsletter).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         LogHelper.LogError(string.Format("Error delete newsletter: {0}", newsletter.Id), ex, 0);
     }
 }
Beispiel #2
0
        internal static void SaveNewsletter(Newsletters newsletter)
        {
            using (Vicdude_NewsletterEntities db = new Vicdude_NewsletterEntities())
            {
                if (newsletter.Id > 0)
                {
                    db.Entry(newsletter).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    newsletter.CreatedDate = DateTime.Now;
                    db.Newsletters.Add(newsletter);
                }

                db.SaveChanges();
            }
        }