/// <summary> /// Gets all blog comments /// </summary> /// <returns>Blog comments</returns> public static BlogCommentCollection GetAllBlogComments() { DBBlogCommentCollection dbCollection = DBProviderManager <DBBlogProvider> .Provider.GetAllBlogComments(); BlogCommentCollection collection = DBMapping(dbCollection); return(collection); }
/// <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 static BlogCommentCollection GetBlogCommentsByBlogPostID(int BlogPostID) { DBBlogCommentCollection dbCollection = DBProviderManager <DBBlogProvider> .Provider.GetBlogCommentsByBlogPostID(BlogPostID); BlogCommentCollection collection = DBMapping(dbCollection); return(collection); }
private static BlogCommentCollection DBMapping(DBBlogCommentCollection dbCollection) { if (dbCollection == null) return null; BlogCommentCollection collection = new BlogCommentCollection(); foreach (DBBlogComment dbItem in dbCollection) { BlogComment item = DBMapping(dbItem); collection.Add(item); } return collection; }
/// <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); }
private static BlogCommentCollection DBMapping(DBBlogCommentCollection dbCollection) { if (dbCollection == null) { return(null); } var collection = new BlogCommentCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); collection.Add(item); } return(collection); }
/// <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; }