// Genererer et antal tilfældige testcentre public void GenerateTestCenter(MyDBContext db, int number = 100) { for (int i = 1; i < (number + 1); i++) { var testcenter = new TestCenter(); testcenter.TestCenterID = i; var temp = random.Next(Municipalities.Count); testcenter.MunicipalityID = Municipalities[temp]; // hvad f**k er hours i TestCenter testcenter.Hours = "8-20"; db.Add(testcenter); db.SaveChanges(); } }
public void createTestCenter(MyDBContext db) { Console.Clear(); Console.WriteLine("Type the ID for the testcenter: "); int TestCenterID = int.Parse(Console.ReadLine()); Console.WriteLine("Type the opening hours of the testcenter (fx. 8-16): "); string hours = Console.ReadLine(); Console.WriteLine("Type the MunicipalityID for the municipality in which the testcenter is: "); int municipalityID = int.Parse(Console.ReadLine()); var TestCenterAdd = new TestCenter() { TestCenterID = TestCenterID, Hours = hours, MunicipalityID = municipalityID }; db.Add(TestCenterAdd); db.SaveChanges(); Console.WriteLine("TestCenter succesfully added!\n"); }