public override BlogItem GetBlog(int id) { // create the post provider object Blog_Posts posts = new Blog_Posts(); posts.ID = id; // get the post with the id DataTable table = posts.SelectOne(); // check to see if a row was returned if (table.Rows.Count > 0) return this.BuildBlog(table.Rows[0]); // nothing was found return null return null; }
public override void AddBlog(BlogItem item) { // create the post from the item Blog_Posts post = new Blog_Posts(); post.Title = item.Title; post.Body = item.Body; post.Published = item.Published; post.AllowComments = item.AllowComments; post.Syndicate = item.Syndicate; post.User_ID = item.PosterID; post.TitleUrl = (item.TitleUrl != null) ? item.TitleUrl.ToString() : null; post.Source = item.Source; post.SourceUrl = (item.SourceUrl != null) ? item.SourceUrl.ToString() : null; post.Created = item.Created; post.Issued = item.Issued; post.Modified = item.Modified; // insert the post into the database post.Insert(); }
public override void RemoveBlog(int id) { Blog_Posts post = new Blog_Posts(); post.ID = id; post.Delete(); }