Ejemplo n.º 1
0
 public DbNews(Database db, int count)
 {
     news = db.SortedSets.Range(0, "news", 0, 10, false).Exec()
            .Select(x =>
     {
         DbNewsEntry ret = JsonConvert.DeserializeObject <DbNewsEntry>(
             Encoding.UTF8.GetString(x.Key));
         ret.Date = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(x.Value);
         return(ret);
     }).ToArray();
 }
Ejemplo n.º 2
0
 public DbNews(IDatabase db, int count)
 {
     news = db.SortedSetRangeByRankWithScores("news", 0, 10)
            .Select(x =>
     {
         DbNewsEntry ret = JsonConvert.DeserializeObject <DbNewsEntry>(
             Encoding.UTF8.GetString(x.Element));
         ret.Date = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds((double)x.Score);
         return(ret);
     }).ToArray();
 }