public IEnumerable <BlogSet> GetBlogs() { using (var dbConext = new MyDb_20180408Entities()) { List <BlogSet> blogs = dbConext.BlogSet.ToList(); return(blogs); } }
public void AddBlog(string title) { using (var dbContext = new MyDb_20180408Entities()) { var newBlog = new BlogSet(); newBlog.BlogTitle = title; dbContext.BlogSet.Add(newBlog); dbContext.SaveChanges(); } }