public void EditBlogPost(BlogPost blogPost)
 {
     var original = _repo.Find<BlogPost>(blogPost.Id);
     original.Title = blogPost.Title;
     original.Source = blogPost.Source;
     original.PostingDate = blogPost.PostingDate;
     original.ArticleContent = blogPost.ArticleContent;
     _repo.SaveChanges();
 }
 public void Edit(BlogPost blogPost)
 {
     var original = this.FindBlog(blogPost.Id);
     original.Title = blogPost.Title;
     original.Source = blogPost.Source;
     original.PostingDate = blogPost.PostingDate;
     original.ArticleContent = blogPost.ArticleContent;
     _db.SaveChanges();
 }
 public IHttpActionResult Post(BlogPost blogPost)
 {
     if (blogPost == null)
     {
         return BadRequest("Missing Blog Post");
     }
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     if (blogPost.Id == 0)
     {
         _blogPostService.AddBlog(blogPost);
         return Created("/Blog" + blogPost.Id, blogPost);
     }
     else
     {
         _blogPostService.EditBlogPost(blogPost);
         return Ok(blogPost);
     }
 }
 public void AddBlog(BlogPost blogPost)
 {
     _repo.Add(blogPost);
     _repo.SaveChanges();
 }
 public void Insert(BlogPost blogPost)
 {
     _db.Blogs.Add(blogPost);
     _db.SaveChanges();
 }