public Blog GetDefaultBlog()
 {
     using (var context = new CodingBlogContext())
     {
         return context.Blogs.SingleOrDefault();
     }
 }
 public Blog GetBlogById(int blogId)
 {
     using (var context = new CodingBlogContext())
     {
         return context.Blogs.SingleOrDefault(blog => blog.Id == blogId);
     }
 }
 public int GetBlogsCount()
 {
     using (var context = new CodingBlogContext())
     {
         return context.Blogs.Count();
     }
 }
Exemple #4
0
 public int GetBlogsCount()
 {
     using (var context = new CodingBlogContext())
     {
         return(context.Blogs.Count());
     }
 }
Exemple #5
0
 public Blog GetDefaultBlog()
 {
     using (var context = new CodingBlogContext())
     {
         return(context.Blogs.SingleOrDefault());
     }
 }
Exemple #6
0
 public Blog GetBlogById(int blogId)
 {
     using (var context = new CodingBlogContext())
     {
         return(context.Blogs.SingleOrDefault(blog => blog.Id == blogId));
     }
 }
 public Blog CreateBlog(Blog blogToCreate)
 {
     using (var context = new CodingBlogContext())
     {
         context.Blogs.Add(blogToCreate);
         context.SaveChanges();
     }
     return blogToCreate;
 }
Exemple #8
0
 public Blog CreateBlog(Blog blogToCreate)
 {
     using (var context = new CodingBlogContext())
     {
         context.Blogs.Add(blogToCreate);
         context.SaveChanges();
     }
     return(blogToCreate);
 }