コード例 #1
0
 public async Task<List<ClassifiedModel>> GetRecentClassifieds(int blockSize)
 {
     using (var context7 = new SiteContext())
     {
         var classifieds =
             context7.Classified.SqlQuery("Select Top " + blockSize + " * from " + Constants.SchemaName +
                                          " [Classifieds]" + "where CurrentStatus = " + Constants.ClassifiedItemAvailable + " order by LastUpdated desc");
         return await classifieds.ToListAsync();
     }
 }
コード例 #2
0
 public async Task<List<ThreadModel>> GetMostCommentedThreads(int num)
 {
     using (var context5 = new SiteContext())
     {
         var rows =
             context5.Threads.SqlQuery("SELECT TOP " + num + " * FROM " + Constants.SchemaName + "[Threads]" +
                                       "ORDER BY Responses desc").ToListAsync();
         return await rows;
     }
 }
コード例 #3
0
 public async Task<List<ThreadModel>> GetRecentRecordsAsync(int blockSize)
 {
     using (var context6 = new SiteContext())
     {
         var model =
             context6.Threads.SqlQuery("Select Top " + blockSize + " * from " + Constants.SchemaName +
                                       " [Threads]" + "order by LastUpdated desc");
         return await model.ToListAsync();
     }
 }
コード例 #4
0
        public async Task<List<string>> GetTrendingTagsAnnouncementAsync()
        {
            using (var context2 = new SiteContext())
            {
                var results =
                    context2.Threads.GroupBy(x => x.TagsAnnouncement)
                        .Select(grp => new { Name = grp.Key, Count = grp.Count() })
                        .OrderByDescending(x => x.Count);

                return
                    await
                        (from item in results
                         where !String.IsNullOrEmpty(item.Name)
                         select item.Name + " (" + item.Count + ") ").ToListAsync();
            }
        }