예제 #1
0
        public async Task <QueryResult <Job> > GetJobsAsync(JobQuery queryObj)
        {
            var result = new QueryResult <Job>();

            var query = _context.Jobs
                        .Include(j => j.Country)
                        .Include(j => j.State)
                        .Include(j => j.EmploymentType)
                        .Include(j => j.SalaryType)
                        .Include(j => j.Category)
                        .Include(j => j.JobBoard)
                        .Include(j => j.Stat)
                        .AsQueryable();

            query = query.ApplyFiltering(queryObj);

            query = query.SortBasedOnListType(queryObj);

            var columnsMap = ColumnsMap.CreateColumnsMap();

            query = query.ApplyOrdering(queryObj, columnsMap);

            result.TotalItems = await query.CountAsync();

            query = query.ApplyPaging(queryObj);

            result.Items = await query.ToListAsync();

            return(result);
        }
예제 #2
0
 public ColumnMap GetColumnMap(string propertyName)
 {
     if (ColumnsMap.ContainsKey(propertyName))
     {
         return(ColumnsMap[propertyName]);
     }
     if (_baseModelMap != null)
     {
         return(_baseModelMap.GetColumnMap(propertyName));
     }
     return(null);
 }
예제 #3
0
 public ProductRepository(StoreContext context)
 {
     _context        = context;
     _sortColumnsMap = ColumnsMap.CreateSortColumnsMap();
 }