Example #1
0
        public ActionResult Update(int id, string tutorFirstName, string tutorLastName, string tutorEmail, string tutorPhoneNumber, int tutorExperience, bool tutorCredential, string tutorAvailability, double tutorRate)
        {
            Tutor currentTutor = Tutor.Find(id);

            currentTutor.Update(tutorFirstName, tutorLastName, tutorEmail, tutorPhoneNumber, tutorExperience, tutorCredential, tutorAvailability, tutorRate, id);
            return(RedirectToAction("Details", new { id = currentTutor.Id }));
        }
Example #2
0
        public ActionResult DeleteSpecialty(int tutorId, int specialtyId)
        {
            Tutor     currentTutor     = Tutor.Find(tutorId);
            Specialty currentSpecialty = Specialty.Find(specialtyId);

            currentTutor.DeleteSpecialty(currentSpecialty);
            return(RedirectToAction("Specialties", new { id = currentTutor.Id }));
        }
Example #3
0
        public ActionResult AddClient(int id, int tutorClient)
        {
            Tutor  currentTutor = Tutor.Find(id);
            Client newClient    = Client.Find(tutorClient);

            currentTutor.AddClient(newClient);
            return(RedirectToAction("Clients"));
        }
Example #4
0
        public ActionResult AddSpecialty(int id, int tutorSpecialty)
        {
            Tutor     currentTutor = Tutor.Find(id);
            Specialty newSpecialty = Specialty.Find(tutorSpecialty);

            currentTutor.AddSpecialty(newSpecialty);
            return(RedirectToAction("Specialties"));
        }
Example #5
0
        public ActionResult DeleteClient(int tutorId, int clientId)
        {
            Tutor  currentTutor  = Tutor.Find(tutorId);
            Client currentClient = Client.Find(clientId);

            currentTutor.DeleteClient(currentClient);
            return(RedirectToAction("Clients", new { id = currentTutor.Id }));
        }
Example #6
0
        public ActionResult AddTutor(int id, int clientTutor)
        {
            Client currentClient = Client.Find(id);
            Tutor  newTutor      = Tutor.Find(clientTutor);

            currentClient.AddTutor(newTutor);
            return(RedirectToAction("Tutors"));
        }
Example #7
0
        public void Find_FindsTutorInDb_Tutor()
        {
            Tutor newTutor = new Tutor("Sean", "Miller", "*****@*****.**", "1234567890", 1, true, "Weekends", 25.00);

            newTutor.Save();
            Tutor foundTutor = Tutor.Find(newTutor.Id);

            Assert.AreEqual(newTutor, foundTutor);
        }
Example #8
0
        public void Update_UpdateTutorFromDb_String()
        {
            Tutor newTutor = new Tutor("Sean", "Miller", "*****@*****.**", "1234567890", 1, true, "Weekends", 25.00);

            newTutor.Save();
            newTutor.Update("Bill", "Miller", "*****@*****.**", "1234567890", 1, true, "Weekends", 25.00, newTutor.Id);
            string actualFirstName = Tutor.Find(newTutor.Id).FirstName;

            Assert.AreEqual("Bill", actualFirstName);
        }
Example #9
0
        public void GetTutorAndClient_GetsAssociatedTutorAndClientFromDb_TutorAndClient()
        {
            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", 13);

            newClient.Save();
            DateTime    time           = new DateTime(1111, 11, 11);
            Appointment newAppointment = new Appointment(newTutor.Id, newClient.Id, time, "123 ABC Street", "Xyz", "ZZ", "12345");

            newAppointment.Save();
            Tutor  actualTutor  = Tutor.Find(newAppointment.TutorId);
            Client actualClient = Client.Find(newAppointment.ClientId);

            Assert.AreEqual(newTutor, actualTutor);
            Assert.AreEqual(newClient, actualClient);
        }
Example #10
0
 public void FindTutor(int id)
 {
     CurrentTutor = Tutor.Find(id);
 }
Example #11
0
        public ActionResult UpdateForm(int id)
        {
            Tutor currentTutor = Tutor.Find(id);

            return(View(currentTutor));
        }
Example #12
0
        public ActionResult DeleteTutorConfirmation(int id)
        {
            Tutor currentTutor = Tutor.Find(id);

            return(View(currentTutor));
        }