Beispiel #1
0
        private IQueryable <Cases> searchQuery(CaseListFilter filter)
        {
            var query = ctx.Cases.AsQueryable();

            if (filter.Year.HasValue)
            {
                query = query.Where(c => c.Year == filter.Year);
            }

            if (!string.IsNullOrEmpty(filter.Prefix))
            {
                query = query.Where(c => c.Prefix.StartsWith(filter.Prefix));
            }

            if (!string.IsNullOrEmpty(filter.Suffix))
            {
                query = query.Where(c => c.Suffix.StartsWith(filter.Suffix));
            }

            if (filter.IsActive.HasValue)
            {
                query = query.Where(c => c.IsActive == filter.IsActive);
            }

            if (filter.IsArchive.HasValue)
            {
                query = query.Where(c => c.IsArchive == filter.IsArchive);
            }

            return(query);
        }
Beispiel #2
0
 public IQueryable <Cases> GetCases(CaseListFilter filter, int maximumRows, int startRowIndex)
 {
     return(searchQuery(filter).OrderBy(c => c.Title).Skip(startRowIndex).Take(maximumRows));
 }
Beispiel #3
0
 public int GetCasesCount(CaseListFilter filter, int maximumRows, int startRowIndex)
 {
     return(searchQuery(filter).Count());
 }