Ejemplo n.º 1
0
 public static void DeleteBlog(int blogId)
 {
     using (MyBlogEntities entities = new MyBlogEntities())
     {
         try
         {
             entities.Blogs.Remove(entities.Blogs.Where(e => e.BlogID == blogId).Select(e => e).First());
             entities.SaveChanges();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Ejemplo n.º 2
0
 public static void InsertBlog(Blog blog)
 {
     using (MyBlogEntities entities = new MyBlogEntities())
     {
         entities.Blogs.Add(blog);
         try
         {
             entities.SaveChanges();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }