Example #1
0
        public static IQueryable <Job> GetJobs(this JobBoardDbContext dbContext, int pageSize = 10, int pageNumber = 1, string location = null)
        {
            // Get query from DbSet
            var query = dbContext.Job.AsQueryable();

            // Filter by: 'Location'
            if (!string.IsNullOrEmpty(location))
            {
                query = query.Where(item => item.Location == location);
            }
            return(query);
        }
Example #2
0
 public static async Task <Job> GetJobsByJobTitleAsync(this JobBoardDbContext dbContext, Job entity)
 => await dbContext.Job.FirstOrDefaultAsync(item => item.JobTitle == entity.JobTitle);