public void CommentLoad(string postRowKey) { List <Comment> comments = _commentRepository.Get().Where(comment => comment.PostRowKey == postRowKey).ToList(); this.RepeaterComments.DataSource = comments; this.RepeaterComments.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; FunnyAppRepository<Post> _postRepository = new FunnyAppRepository<Post>(); List<PostViewData> viewDatas = new List<PostViewData>(); _postRepository.Get().Where(post => post.UserId == Membership.GetUser(Page.User.Identity.Name).ProviderUserKey.ToString()).ToList() .Where(post=> post.State) .OrderByDescending(post => post.Timestamp) .Take(20).ToList().ForEach(post => viewDatas.Add(new PostViewData() { PostContent = post.PostContent, PostImage = post.PostImage, RowKey = post.RowKey, UserId = post.UserId })); this.RepeaterImages.DataSource = viewDatas; this.RepeaterImages.DataBind(); }
public string TagBuilder(string postRowKey) { List <string> tags = new List <string>(); List <Tag> result = _tagRepository.Get().Where(t => t.PostRowKey == postRowKey).ToList(); foreach (var tag in result) { tags.Add(tag.TagName); } StringBuilder builder = new StringBuilder(); foreach (var tag in tags.Distinct()) { builder.Append(string.Format("<a href='/Tags.aspx?tag={0}'>{1}</a>", tag, tag)); } return(builder.ToString()); }
protected void Page_Load(object sender, EventArgs e) { string queryString = Request.QueryString["q"]; if (!string.IsNullOrEmpty(queryString)) { Post post = _postRepository.Get().Where(p => p.RowKey == queryString).ToList().FirstOrDefault(); if (post != null) { ImageYou.ImageUrl = post.PostImage; LabelDescription.Text = post.PostContent; LabelTitle.Text = post.PostTitle; this.CommentLoad(queryString); HiddenFieldPost.Value = queryString; } LiteralTag.Text = TagBuilder(post.RowKey); } }
protected void Page_Load(object sender, EventArgs e) { Page.Title = "Home"; if(IsPostBack)return; FunnyAppRepository<Post> _postRepository = new FunnyAppRepository<Post>(); List<PostViewData> viewDatas = new List<PostViewData>(); _postRepository.Get().Where(post => post.State == true).ToList() .OrderByDescending(post => post.Timestamp) .Take(20).ToList().ForEach(post => viewDatas.Add(new PostViewData() { PostContent = post.PostContent, PostImage = post.PostImage, RowKey = post.RowKey, UserId = post.UserId })); this.RepeaterImages.DataSource = viewDatas; this.RepeaterImages.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if(IsPostBack)return; FunnyAppRepository<Tag> _tagRepository = new FunnyAppRepository<Tag>(); List<string> tags = new List<string>(); foreach (var tag in _tagRepository.Get().ToList()) { tags.Add(tag.TagName); } StringBuilder builder = new StringBuilder(); foreach (var tag in tags.Distinct()) { builder.Append(string.Format("<a href='/Tags.aspx?tag={0}'>{1}</a>", tag, tag)); } LiteralTag.Text = builder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } FunnyAppRepository <Post> _postRepository = new FunnyAppRepository <Post>(); List <PostViewData> viewDatas = new List <PostViewData>(); _postRepository.Get().Where(post => post.UserId == Membership.GetUser(Page.User.Identity.Name).ProviderUserKey.ToString()).ToList() .Where(post => post.State) .OrderByDescending(post => post.Timestamp) .Take(20).ToList().ForEach(post => viewDatas.Add(new PostViewData() { PostContent = post.PostContent, PostImage = post.PostImage, RowKey = post.RowKey, UserId = post.UserId })); this.RepeaterImages.DataSource = viewDatas; this.RepeaterImages.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string queryString = Request.QueryString["q"]; if (!string.IsNullOrEmpty(queryString)) { FunnyAppRepository<Post> postRepository = new FunnyAppRepository<Post>(); List<PostViewData> viewDatas = new List<PostViewData>(); postRepository.Get().Where(m => m.State == true) .ToList() .Where(m => m.PostTitle.StartsWith(queryString, StringComparison.OrdinalIgnoreCase)) .ToList() .ForEach(post => viewDatas.Add(new PostViewData() { RowKey = post.RowKey, PostContent = post.PostContent, PostImage = post.PostImage, PostTitle = post.PostTitle })); this.RepeaterImages.DataSource = viewDatas; this.RepeaterImages.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Page.Title = "Home"; if (IsPostBack) { return; } FunnyAppRepository <Post> _postRepository = new FunnyAppRepository <Post>(); List <PostViewData> viewDatas = new List <PostViewData>(); _postRepository.Get().Where(post => post.State == true).ToList() .OrderByDescending(post => post.Timestamp) .Take(20).ToList().ForEach(post => viewDatas.Add(new PostViewData() { PostContent = post.PostContent, PostImage = post.PostImage, RowKey = post.RowKey, UserId = post.UserId })); this.RepeaterImages.DataSource = viewDatas; this.RepeaterImages.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string queryString = Request.QueryString["q"]; if (!string.IsNullOrEmpty(queryString)) { FunnyAppRepository <Post> postRepository = new FunnyAppRepository <Post>(); List <PostViewData> viewDatas = new List <PostViewData>(); postRepository.Get().Where(m => m.State == true) .ToList() .Where(m => m.PostTitle.StartsWith(queryString, StringComparison.OrdinalIgnoreCase)) .ToList() .ForEach(post => viewDatas.Add(new PostViewData() { RowKey = post.RowKey, PostContent = post.PostContent, PostImage = post.PostImage, PostTitle = post.PostTitle })); this.RepeaterImages.DataSource = viewDatas; this.RepeaterImages.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { string queryString = Request.QueryString["tag"]; if (!string.IsNullOrEmpty(queryString)) { List <Tag> result = _tagRepository.Get() .Where(t => t.TagName.Equals(queryString, StringComparison.OrdinalIgnoreCase)) .ToList(); List <PostViewData> temp = new List <PostViewData>(); foreach (Tag t in result) { PostViewData post = PostRowByPost(t.PostRowKey, t.PostPartitionKey); if (post != null) { temp.Add(post); } } this.RepeaterImages.DataSource = temp; this.RepeaterImages.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } FunnyAppRepository <Tag> _tagRepository = new FunnyAppRepository <Tag>(); List <string> tags = new List <string>(); foreach (var tag in _tagRepository.Get().ToList()) { tags.Add(tag.TagName); } StringBuilder builder = new StringBuilder(); foreach (var tag in tags.Distinct()) { builder.Append(string.Format("<a href='/Tags.aspx?tag={0}'>{1}</a>", tag, tag)); } LiteralTag.Text = builder.ToString(); }