예제 #1
0
        // Genererer et antal tilfældige TestCenterManagements
        public void GenerateTestCenterManagement(MyDBContext db, int number = 100)
        {
            for (int i = 1; i < (number + 1); i++)
            {
                var tcm = new TestCenterManagement();
                tcm.PhoneNumber = 10000000 + i;
                tcm.Email       = "random@mail" + i.ToString() + ".dk";

                var temp = random.Next(Municipalities.Count);
                tcm.TestCenterID = i;

                db.Add(tcm);
                db.SaveChanges();
            }
        }
예제 #2
0
        public void createManagement(MyDBContext db)
        {
            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
            };

            db.Add(TestCenterManagementAdd);
            db.SaveChanges();

            Console.WriteLine("TestCenterManagement succesfully added!\n");
        }