예제 #1
0
        public ActionResult AddClient(int id, int tutorClient)
        {
            Tutor  currentTutor = Tutor.Find(id);
            Client newClient    = Client.Find(tutorClient);

            currentTutor.AddClient(newClient);
            return(RedirectToAction("Clients"));
        }
예제 #2
0
        public void AddsGetsClients_AddsAndGetsAssociatedClientsFromDb_ClientList()
        {
            Tutor newTutor = new Tutor("Sean", "Miller", "*****@*****.**", "1234567890", 1, true, "Weekends", 25.00);

            newTutor.Save();
            Client newClient = new Client("Ashley", "Adelman", "*****@*****.**", "1234567890", "123 ABC Street", "Xyz", "ZZ", "12345", 15);

            newClient.Save();
            newTutor.AddClient(newClient);
            List <Client> expectedList = new List <Client> {
                newClient
            };
            List <Client> actualList = newTutor.GetClients();

            CollectionAssert.AreEqual(expectedList, actualList);
        }