Ejemplo n.º 1
0
 public static bool UpdateSocialArticle(DBO.SocialArticle socialArticle)
 {
     using (IziWatchEntities bdd = new IziWatchEntities())
     {
         try
         {
             T_SocialArticle t_socialArticle = bdd.T_SocialArticle.Where(x => x.id == socialArticle.Id).FirstOrDefault();
             if (t_socialArticle != null)
             {
                 t_socialArticle.id        = socialArticle.Id;
                 t_socialArticle.text      = socialArticle.Text;
                 t_socialArticle.image     = socialArticle.Image;
                 t_socialArticle.social_id = socialArticle.SocialId;
                 bdd.SaveChanges();
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Ejemplo n.º 2
0
 public static bool CreateSocialArticle(DBO.SocialArticle socialArticle)
 {
     using (IziWatchEntities bdd = new IziWatchEntities())
     {
         try
         {
             T_SocialArticle t_socialArticle = new T_SocialArticle()
             {
                 id        = socialArticle.Id,
                 text      = socialArticle.Text,
                 image     = socialArticle.Image,
                 social_id = socialArticle.SocialId
             };
             bdd.T_SocialArticle.Add(t_socialArticle);
             bdd.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }