Beispiel #1
0
        public void createTestCenter(TestCenterService tcs)
        {
            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
            };

            tcs.Create(TestCenterAdd);

            Console.WriteLine("TestCenter succesfully added!\n");
        }
Beispiel #2
0
        // Genererer et antal tilfældige testcentre
        public void GenerateTestCenter(TestCenterService tcs, int number = 100)
        {
            // Clears the database of TestCenter
            var myTestCenters = tcs.Get();

            foreach (var i in myTestCenters)
            {
                tcs.Remove(i);
            }

            for (int i = 1; i < (number + 1); i++)
            {
                var temp = random.Next(Municipalities.Count);

                var testcenter = new TestCenter()
                {
                    TestCenterID   = i,
                    MunicipalityID = Municipalities[temp],
                    Hours          = "8-20"
                };

                tcs.Create(testcenter);
            }
        }
Beispiel #3
0
 public void Remove(TestCenter testCenterIn) =>
 _testcenters.DeleteOne(testcenter => testcenter.TestCenterID == testCenterIn.TestCenterID);
Beispiel #4
0
 public void Update(int testCenterID, TestCenter testCenterIn) =>
 _testcenters.ReplaceOne(testcenter => testcenter.TestCenterID == testCenterID, testCenterIn);
Beispiel #5
0
 //Create, Update, Remove
 public TestCenter Create(TestCenter testCenter)
 {
     _testcenters.InsertOne(testCenter);
     return(testCenter);
 }
 public List <TestCenterCitizen> GetTestCenter(TestCenter testcenter) =>
 _testcentercitizens.Find(testcentercitizen => testcentercitizen.testCenter == testcenter).ToList();