public async Task <IActionResult> Index() { var jobModels = _jobs.GetAll().Where(j => j.Status == "1"); var user = await _userManager.GetUserAsync(User); var EC = true; if (user == null) { EC = false; } else { EC = user.EmailConfirmed; } var listingResult = jobModels .Select(result => new JobIndexListingModel { Id = result.Id, Title = result.Title, Description = result.Description, Price = result.Price, DateCreated = result.DateCreated, DateExpire = result.DateExpire, User = result.ApplicationUser }); var model = new JobIndexModel() { Jobs = listingResult, IsEmailConfirmed = EC }; return(View(model)); }
public IActionResult SearchJob(string item) { var jobModels = _jobs.GetAll().Where(j => j.Status == "1" && (j.Title.ToLower().Contains(item) || j.Description.ToLower().Contains(item))); var listingResult = jobModels .Select(result => new JobIndexListingModel { Id = result.Id, Title = result.Title, Description = result.Description, Price = result.Price, DateCreated = result.DateCreated, DateExpire = result.DateExpire, User = result.ApplicationUser }); var model = new JobIndexModel() { Jobs = listingResult, SearchedString = item }; return(View(model)); }
public IActionResult SearchJob(JobIndexModel model) { return(RedirectToAction("SearchJob", "JobList", new { item = model.SearchedString })); }