private static IList <Placement> GetPlacements(string location) { var sr = new StreamReader(location); var placements = new List <Placement>(); var foreignKey = new ForeignKeys(); string s = sr.ReadLine(); while (s != null) { var newPlacement = new Placement { OpeningNumber = foreignKey.GetRandomOpening(), CandidateNumber = foreignKey.GetRandomCandidate(), //TotalWorkHours = Convert.ToDouble(s) }; newPlacement.PlacementStatus = placements.Count % 5 != 0 ? "Qualified" : "Pending"; placements.Add(newPlacement); s = sr.ReadLine(); } return(placements); }
private IList <Application> GetApplications(string location) { var sr = new StreamReader(location); var applicationsList = new List <Application>(); var foreignKey = new ForeignKeys(); string s = sr.ReadLine(); while (s != null) { var application = new Application { ApplicationDate = Convert.ToDateTime(s), CandidateNumber = foreignKey.GetRandomCandidate(), OpeningNumber = foreignKey.GetRandomOpening(), }; application.ApplicationStatus = applicationsList.Count % 3 == 0 ? "Pending" : "Qualified"; applicationsList.Add(application); s = sr.ReadLine(); } return(applicationsList); }
public static void GeneratePlacements() { using var context = new TecContext(); var foreignKey = new ForeignKeys(); for (int i = 0; i < 200; i++) { var newPlacement = new Placement { CandidateNumber = foreignKey.GetRandomCandidate(), OpeningNumber = foreignKey.GetRandomOpening(), PlacementStatus = i % 5 != 0 ? "Qualified" : "Pending" }; context.Add(newPlacement); context.SaveChanges(); } }