// GET: Dashboard public ActionResult Index(string search) { IEnumerable <JobPost> _jobPost = null; _jobPost = !String.IsNullOrEmpty(search) ? _jobPostRepo.GetJobPostsWhere(search) : _jobPostRepo.GetJobPostsWithApplicants(); var model = _jobPost.Select(s => new JobPostModel { DateCreated = s.DateCreated, Description = s.Description, JobTitle = s.JobTitle, Id = s.Id, IsClosed = s.IsClosed, Withdraw = s.Applicants.Count(x => x.HiringStatus == "Withdraw"), ImmediateRejection = s.Applicants.Count(x => x.HiringStatus == "Immediate Rejection"), Interviewed = s.Applicants.Count(x => x.HiringStatus == "Interview"), Hired = s.Applicants.Count(x => x.HiringStatus == "Hired"), New = s.Applicants.Count(x => x.HiringStatus == "New"), TotalApplications = s.Applicants.Count() }); return(View(model)); }