Beispiel #1
0
        public void createManagement(TestCenterManagementService tcms, TestCenterService tcs)
        {
            Console.Clear();
            Console.WriteLine("Type in TestCenterManagements PhoneNumber:(8 digits): ");
            int phonenumber = int.Parse(Console.ReadLine());

            Console.WriteLine("Type in TestCenterManagements Email: ");
            string email = Console.ReadLine();

            Console.WriteLine("Type in TestCenterID for the TestCenter that the this Management will manage: ");
            int testcenterid = int.Parse(Console.ReadLine());

            var TestCenterManagementAdd = new TestCenterManagement()
            {
                PhoneNumber  = phonenumber,
                Email        = email,
                TestCenterID = testcenterid,
                testCenter   = tcs.Get(testcenterid)
            };

            tcms.Create(TestCenterManagementAdd);

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

            foreach (var i in myTestCenterManagements)
            {
                tcms.Remove(i);
            }

            for (int i = 1; i < (number + 1); i++)
            {
                var temp = random.Next(Municipalities.Count);
                var tcm  = new TestCenterManagement()
                {
                    PhoneNumber  = 10000000 + i,
                    Email        = "random@mail" + i.ToString() + ".dk",
                    TestCenterID = i,
                    testCenter   = tcs.Get(i)
                };

                tcms.Create(tcm);
            }
        }
 public void Update(int phoneNumber, TestCenterManagement testCenterManagementIn) =>
 _testcentermanagements.ReplaceOne(testcentermanagement => testcentermanagement.PhoneNumber == phoneNumber, testCenterManagementIn);
 public void Remove(TestCenterManagement testCenterManagementIn) =>
 _testcentermanagements.DeleteOne(testcentermanagement => testcentermanagement.PhoneNumber == testCenterManagementIn.PhoneNumber);
 //Create, Update, Remove
 public TestCenterManagement Create(TestCenterManagement testCenterManagement)
 {
     _testcentermanagements.InsertOne(testCenterManagement);
     return(testCenterManagement);
 }