예제 #1
0
 public IList <Document> Search(int skip, int take, string name)
 {
     try
     {
         IList <Document> l;
         if (!string.IsNullOrEmpty(name))
         {
             l = _repository.GetAll().Where(j => j.Author.StartsWith(name) ||
                                            j.Content.StartsWith(name)).OrderByDescending(j => j.CreateDate).Skip(skip).Take(take).ToList();
         }
         else
         {
             l = _repository.GetAll().OrderByDescending(j => j.CreateDate).Skip(skip).Take(take).ToList();
         }
         foreach (var q in l)
         {
             q.Number = _fn.ConvertDaysOrHour(q.CreateDate);
         }
         return(l);
     }
     catch (Exception e)
     {
         return(new List <Document>());
     }
 }