Пример #1
0
 public IEnumerable <BlogSet> GetBlogs()
 {
     using (var dbConext = new MyDb_20180408Entities())
     {
         List <BlogSet> blogs = dbConext.BlogSet.ToList();
         return(blogs);
     }
 }
Пример #2
0
        public void AddBlog(string title)
        {
            using (var dbContext = new MyDb_20180408Entities())
            {
                var newBlog = new BlogSet();
                newBlog.BlogTitle = title;

                dbContext.BlogSet.Add(newBlog);
                dbContext.SaveChanges();
            }
        }