public static bool AddDoctor(HospitalContext dbContext) { Console.Clear(); Console.Write("Enter name: "); string doctorName = Console.ReadLine(); Console.Write("Enter specialty: "); string specialty = Console.ReadLine(); Console.Write("Enter E-Mail Address: "); string emailAddress = Console.ReadLine(); Console.Write("Enter Password: "); string password = EncryptionHelper.Encrypt(Console.ReadLine()); if (PatientDataValidation.IsEmailAddressValid(emailAddress)) { dbContext.Add(new Doctor { DoctorName = doctorName, Specialty = specialty, EmailAddress = emailAddress, Password = password }); dbContext.SaveChanges(); return(true); } else { return(false); } }
public Patient(string firstName, string middleName, string lastName, string address, string emailAddress, bool hasInsurence) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.Address = address; this.HasInsurence = hasInsurence; if (PatientDataValidation.IsEmailAddressValid(emailAddress)) { this.EmailAddress = emailAddress; } else { throw new ArgumentException($"Invalid EmailAddress {emailAddress}"); } }