示例#1
0
        public IQueryable<SeqPost> PostsForTag(SeqTag tag, string sortOrder,
															int pageSize, int pageNum)
        {
            pageSize = (pageSize > MAX_PAGE_SIZE) ? MAX_PAGE_SIZE : pageSize;
            IQueryable<SeqPost> posts;
            switch (sortOrder) {
                case "desc":
                    posts = tag.SeqPosts
                                  .OrderByDescending(p=>p.CreateDate)
                                  .Skip((pageNum - 1) * pageSize)
                                  .Take(pageSize)
                                  .AsQueryable<SeqPost>();
                    break;
                default:
                    posts = tag.SeqPosts
                                  .OrderBy(p => p.CreateDate)
                                  .Skip((pageNum - 1) * pageSize)
                                  .Take(pageSize)
                                  .AsQueryable<SeqPost>();
                    break;
            }
            return posts;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the SeqTags EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSeqTags(SeqTag seqTag)
 {
     base.AddObject("SeqTags", seqTag);
 }
 /// <summary>
 /// Create a new SeqTag object.
 /// </summary>
 /// <param name="tagId">Initial value of the TagId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="lastUpdated">Initial value of the LastUpdated property.</param>
 /// <param name="tally">Initial value of the Tally property.</param>
 /// <param name="blogId">Initial value of the BlogId property.</param>
 public static SeqTag CreateSeqTag(global::System.Int32 tagId, global::System.String name, global::System.DateTime lastUpdated, global::System.Int32 tally, global::System.String blogId)
 {
     SeqTag seqTag = new SeqTag();
     seqTag.TagId = tagId;
     seqTag.Name = name;
     seqTag.LastUpdated = lastUpdated;
     seqTag.Tally = tally;
     seqTag.BlogId = blogId;
     return seqTag;
 }