Wednesday, 15 March 2017

Join

        #region GetPostData
        private void GetPostData()
        {
            try
            {
                var post = GetPostList().ToList();
                var user = GetUserList().ToList();
                var comment = GetCommentList().ToList();
                var like = GetLikeList().ToList();              
                         
                             select new
                             {
                                 a.BlogPost_Id,
                                 a.BlogPost_Title,
                                 a.BlogPost_Content,
                                 a.BlogPost_Attachment,
                                 a.BlogPost_Status,
                                 a.BlogPost_PublishedOn,
                                 b.BlogUser_ID,
                                 b.User_Name,
                                 cCountcom= (from cm in comment where cm.BlogPost_Id == a.BlogPost_Id select cm).Count(),
                                 cCountlik = (from lk in like where lk.BlogPost_Id == a.BlogPost_Id select lk).Count(),
                             }).ToList();

                RadListView1.DataSource = null;
                RadListView1.DataSource = query.ToList();
                RadListView1.DataBind();
            }
            catch (Exception)
            {

            }
        }

No comments:

Post a Comment