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); }
public static async Task <Job> GetJobsByJobTitleAsync(this JobBoardDbContext dbContext, Job entity) => await dbContext.Job.FirstOrDefaultAsync(item => item.JobTitle == entity.JobTitle);