public EquinityExerciseDbContext(DbContextOptions options) : base(options) { // Just add some sample data if (Interviews.ToList().Count != 0) { return; } var candidate1 = new JobCandidate() { Name = "Patryk Nguyen" }; var candidate2 = new JobCandidate() { Name = "Somebody else" }; JobCandidates.Add(candidate1); JobCandidates.Add(candidate2); Interviews.Add(new Interview() { JobCandidateId = 1, IsInterviewResultPositive = true }); Interviews.Add(new Interview() { JobCandidateId = 2, IsInterviewResultPositive = false }); this.SaveChanges(); }
public Interviews GetPositiveInterviews() { var interviewsData = _Context.Interviews .Include(i => i.JobCandidate) .ToList(); var interviews = new Interviews(interviewsData); return(interviews.GetPositiveInterviews()); }