public string GetUserCommentsById(string userId) { CommentsList commentsList = new CommentsList(); commentsList = commentsList.GetByUserId(new Guid(userId)); return(JsonConvert.SerializeObject(commentsList.List)); }
protected void Page_Load(object sender, EventArgs e) { fuChangeProfileImage.Enabled = false; btnChangePicture.Enabled = false; fuChangeProfileImage.Visible = false; btnChangePicture.Visible = false; if (Request.QueryString["userId"] != null) { MasterPage masterpage = Page.Master; HtmlAnchor anchor = (HtmlAnchor)masterpage.FindControl("ancLogin"); Guid userId = new Guid(Request.QueryString["userId"]); User user = new User(); user = user.GetById(userId); lblUserName.Text = user.UserName; imgProfile.ImageUrl = "~/" + user.ProfilePic; PostList posts = new PostList(); posts = posts.GetByUserId(userId); CommentsList comments = new CommentsList(); comments = comments.GetByUserId(userId); //rptPost.DataSource = posts.List; //rptPost.DataBind(); //rptComments.DataSource = comments.List; //rptComments.DataBind(); anchor.HRef = "/Account/Login.aspx?returnURL=/Account/Profile.aspx?userId=" + userId; if (Session["User"] != null) { if (((User)Session["User"]).Id == userId) { btnChangePicture.Enabled = true; fuChangeProfileImage.Enabled = true; fuChangeProfileImage.Visible = true; btnChangePicture.Visible = true; } } } else { Response.Redirect("/Default.aspx"); } }