Ejemplo n.º 1
0
        } // CommentInsert

        public static List <Blog.Comment> CommentSelect()
        {
            List <Blog.Comment> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Comment_Select"
                                    , inputParamMapper : null, map : delegate(IDataReader reader, short set)
            {
                Blog.Comment b    = new Blog.Comment();
                int startingIndex = 0;

                b.ID           = reader.GetSafeInt32(startingIndex++);
                b.BlogPostID   = reader.GetSafeInt32(startingIndex++);
                b.Title        = reader.GetSafeString(startingIndex++);
                b.Content      = reader.GetSafeString(startingIndex++);
                b.UserName     = reader.GetSafeString(startingIndex++);
                b.DateCreated  = reader.GetSafeDateTime(startingIndex++);
                b.DateModified = reader.GetSafeDateTime(startingIndex++);

                if (list == null)
                {
                    list = new List <Blog.Comment>();
                }

                list.Add(b);
            }
                                    );


            return(list);
        } //CommentSelect
Ejemplo n.º 2
0
        } //CommentSelect

        public static List <Blog.Comment> CommentSelectByBlogId(int blogId)
        {
            List <Blog.Comment> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Comment_SelectByBlogId"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@BlogPostId", blogId);
            }, map : delegate(IDataReader reader, short set)
            {
                Blog.Comment b    = new Blog.Comment();
                int startingIndex = 0;

                b.BlogPostID   = reader.GetSafeInt32(startingIndex++);
                b.Title        = reader.GetSafeString(startingIndex++);
                b.Content      = reader.GetSafeString(startingIndex++);
                b.UserName     = reader.GetSafeString(startingIndex++);
                b.DateCreated  = reader.GetSafeDateTime(startingIndex++);
                b.DateModified = reader.GetSafeDateTime(startingIndex++);

                if (list == null)
                {
                    list = new List <Blog.Comment>();
                }

                list.Add(b);
            }
                                    );

            return(list);
        } // CommentSelectByBlogId -- in blogsapicontroller
Ejemplo n.º 3
0
        } // CommentSelectByBlogId -- in blogsapicontroller

        public static Blog.Comment CommentSelectById(int commentId)
        {
            Blog.Comment row = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Comment_SelectById"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@ID", commentId);
            }, map : delegate(IDataReader reader, short set)
            {
                Blog.Comment b    = new Blog.Comment();
                int startingIndex = 0;

                b.ID           = reader.GetSafeInt32(startingIndex++);
                b.BlogPostID   = reader.GetSafeInt32(startingIndex++);
                b.Title        = reader.GetSafeString(startingIndex++);
                b.Content      = reader.GetSafeString(startingIndex++);
                b.UserName     = reader.GetSafeString(startingIndex++);
                b.DateCreated  = reader.GetSafeDateTime(startingIndex++);
                b.DateModified = reader.GetSafeDateTime(startingIndex++);

                if (row == null)
                {
                    row = b;
                }
            }
                                    );

            return(row);
        } // CommentSelectById