/// <summary> /// Gets all blog comments /// </summary> /// <returns>Blog comments</returns> public override DBBlogCommentCollection GetAllBlogComments() { DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadAll"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBBlogComment blogComment = GetBlogCommentFromReader(dataReader); blogCommentCollection.Add(blogComment); } } return(blogCommentCollection); }
/// <summary> /// Gets a collection of blog comments by blog post identifier /// </summary> /// <param name="BlogPostID">Blog post identifier</param> /// <returns>A collection of blog comments</returns> public override DBBlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID) { DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection(); if (BlogPostID == 0) { return(blogCommentCollection); } Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadByBlogPostID"); db.AddInParameter(dbCommand, "BlogPostID", DbType.Int32, BlogPostID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBBlogComment blogComment = GetBlogCommentFromReader(dataReader); blogCommentCollection.Add(blogComment); } } return(blogCommentCollection); }
/// <summary> /// Gets all blog comments /// </summary> /// <returns>Blog comments</returns> public override DBBlogCommentCollection GetAllBlogComments() { DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadAll"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBBlogComment blogComment = GetBlogCommentFromReader(dataReader); blogCommentCollection.Add(blogComment); } } return blogCommentCollection; }
/// <summary> /// Gets a collection of blog comments by blog post identifier /// </summary> /// <param name="BlogPostID">Blog post identifier</param> /// <returns>A collection of blog comments</returns> public override DBBlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID) { DBBlogCommentCollection blogCommentCollection = new DBBlogCommentCollection(); if (BlogPostID == 0) return blogCommentCollection; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogCommentLoadByBlogPostID"); db.AddInParameter(dbCommand, "BlogPostID", DbType.Int32, BlogPostID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBBlogComment blogComment = GetBlogCommentFromReader(dataReader); blogCommentCollection.Add(blogComment); } } return blogCommentCollection; }