static void Main(string[] args) { AllCandidates ac = new AllCandidates(); String selectedCandidates = "Name — - Cert Type — - Location" + "\n" + " — — — — — — — — — — — — — — — — — — — "; while (ac.HasNext()) { Candidate c = (Candidate)ac.Next(); selectedCandidates = selectedCandidates + "\n" + c.GetName() + " - " + c.GetCertificationType() + " - " + c.GetLocation(); } Console.WriteLine(selectedCandidates); Console.ReadKey(); }
public async Task <IEnumerable <AllCandidates> > GetAllCandidates() { AllCandidates candidates = null; List <AllCandidates> cands = new List <AllCandidates>(); try { var result = await(from ca in _context.Candidate join slc in _context.ShortListedCandidate on ca.CandidateId equals slc.CandidateId join p in _context.Position on slc.PositionId equals p.PositionId select new { ca.CandidateId, ca.FirstName, ca.LastName, ca.Gender, p.PositionTitle, p.PositionId }).ToListAsync(); if (result != null) { foreach (var item in result) { candidates = new AllCandidates(item.CandidateId, item.PositionId) { FirstName = item.FirstName.Trim(), LastName = item.LastName.Trim(), Gender = item.Gender.Trim(), PositionTitle = item.PositionTitle.Trim() }; cands.Add(candidates); } } } catch (Exception) { } return(cands); }