public Boolean addNewCon(int conID, string firstName, string lastName, string phone, string dob, string address, string symptoms, string date, string time) { try { int maxId = 0; //need some code to avoid dulicate usernames //maybe add some logic (busiess rules) about password policy //IUser user = new User(name, password, userType); // Construct a User Object foreach (Consultation con in ConList) { if (con.ConID > maxId) { maxId = con.ConID; } } IConsultation theCon = ConsultationFactory.GetCon(maxId + 1, firstName, lastName, phone, dob, address, symptoms, date, time); // Using a Factory to create the user entity object. ie seperating object creation from business logic ConList.Add(theCon); // Add a reference to the newly created object to the Models UserList DataLayer.addNewConToDB(theCon); //Gets the DataLayer to add the new user to the DB. return(true); } catch (System.Exception excep) { return(false); } }
public static void SetCon(IConsultation aCon) // This provides a seam in the factory where I can prime the factory with the user it will then cough up. (for test code) { consultation = aCon; }
public bool editCon(IConsultation con) { DataLayer.editConInDB(con); return(true); }
public bool deleteCon(IConsultation cons) { DataLayer.deleteConFromDB(cons); ConList.Remove(cons); //remove object from collection return(true); }