Пример #1
0
        protected static IQueryable<Comment> CommentSort(IProviderCommentFilter filter, IQueryable<Comment> query)
        {
            // Sort grid data.  Sord is sort order, Sidx is the index to sort on
            if (filter.Sord == "desc")
            {
                // Sort by date if we don't know what this was
                query = query.OrderByDescending(aComment => aComment.EditDate);
            }
            else if (filter.Sord == "asc")
            {
                // Sort by date if we don't know what this was
                query = query.OrderBy(aComment => aComment.EditDate);
            }

            return query;
        }
Пример #2
0
 public static List<ProviderComment> Load(IProviderCommentFilter filter)
 {
     int m = (filter.Page - 1);
     if (m < 0) m = 0;
     int skip = filter.Rows * m;
     IQueryable<Comment> query = DbCtx.Instance.Comments;
     query = CommentFilter(filter, query);
     query = CommentSort(filter, query);
     return query.Skip(skip)
                 .Take(filter.Rows)
                 .ToList()
                 .ConvertAll(_converterEntityToProvider);
 }
Пример #3
0
 protected static IQueryable<Comment> CommentFilter(IProviderCommentFilter filter, IQueryable<Comment> query)
 {
     return query.Where(aComment => aComment.IsFlagged >= filter.CountFlags &&
                                     (filter.Id == null || aComment.Id == filter.Id) &&
                                     (filter.IsHidden == null || aComment.IsHidden == filter.IsHidden) &&
                                     (filter.IgnoreFlags == null || aComment.IgnoreFlags == filter.IgnoreFlags)
                     );
 }
Пример #4
0
 public static int Count(IProviderCommentFilter filter)
 {
     IQueryable<Comment> query = DbCtx.Instance.Comments;
     query = CommentFilter(filter, query);
     return query.Count();
 }