public static void PostDoctorReview(NewDoctorReview review) { if (Users == null) { Initialize(); } DoctorsModelDetails doctor = Doctors.FirstOrDefault(x => x.DoctorID == review.DoctorID); doctor.DoctorRating = doctor.DoctorReviews.Average(x => x.DoctorRating).ToString(); doctor.DoctorReviews.Add(review); }
private static void Initialize() { Random rando = new Random(DateTime.Now.Millisecond); Users = new List <LoginModel>(); Users.Add(new LoginModel { Username = "******", Password = "******" }); Users.Add(new LoginModel { Username = "******", Password = "******" }); Insurance = new List <InsuranceModelDetails>(); for (int i = 1; i < 11; i++) { InsuranceModelDetails newInsurance = new InsuranceModelDetails(); newInsurance.InsuranceID = i; newInsurance.InsuranceName = "Insurance Company " + i.ToString(); newInsurance.InsuranceAddress = (i * 100).ToString() + " Tryon Street"; newInsurance.InsuranceCity = "Charlotte"; newInsurance.InsuranceState = "NC"; newInsurance.InsuranceZip = "12345-1234"; newInsurance.InsurancePhone = "555-123-123" + (i - 1).ToString(); Insurance.Add(newInsurance); } Doctors = new List <DoctorsModelDetails>(); for (int i = 1; i < 11; i++) { DoctorsModelDetails newDoctor = new DoctorsModelDetails(); newDoctor.DoctorID = i; newDoctor.DoctorName = "Doctor " + i.ToString(); newDoctor.DoctorAddress = (i * 100).ToString() + " Tryon Street"; newDoctor.DoctorCity = "Charlotte"; newDoctor.DoctorState = "NC"; newDoctor.DoctorZip = "12345-1234"; int randNum = rando.Next(0, 10); if (randNum == 0) { newDoctor.DoctorReviews = null; newDoctor.DoctorRating = null; } else { newDoctor.DoctorReviews = new List <DoctorReviewsBase>(); for (int j = 0; j < randNum; j++) { DoctorReviewsBase newReview = new DoctorReviewsBase(); newReview.DoctorReview = "Review " + (j + 1).ToString(); newReview.DoctorRating = rando.Next(1, 5); newDoctor.DoctorReviews.Add(newReview); } newDoctor.DoctorRating = newDoctor.DoctorReviews.Average(x => x.DoctorRating).ToString(); } newDoctor.AcceptedInsurance = new List <InsuranceModelBase>(); randNum = rando.Next(0, 5); for (int j = 0; j < randNum; j++) { int insuranceNum = rando.Next(1, 10); if (!newDoctor.AcceptedInsurance.Any(x => x.InsuranceID == insuranceNum)) { newDoctor.AcceptedInsurance.Add(Insurance.FirstOrDefault(x => x.InsuranceID == insuranceNum)); } } Doctors.Add(newDoctor); } Problems = new List <ProblemsModelList>(); ProblemsModelList parent = new ProblemsModelList(); parent.ProblemID = 0; parent.ProblemName = ""; parent.ProblemDescription = ""; ProblemsModelList chest = new ProblemsModelList(); chest.ProblemID = 1; chest.ProblemName = "Chest Problems"; chest.ProblemDescription = "Any issues in the chest area."; ProblemsModelList heart = new ProblemsModelList(); heart.ProblemID = 2; heart.ProblemName = "Heart Problems"; heart.ProblemDescription = "Any issues with the heart."; ProblemsModelList heartAttack = new ProblemsModelList(); heartAttack.ProblemID = 3; heartAttack.ProblemName = "Heart Attack"; heartAttack.ProblemDescription = "History of Heart Attacks"; ProblemsModelList arrythmia = new ProblemsModelList(); arrythmia.ProblemID = 4; arrythmia.ProblemName = "Arrythmia"; arrythmia.ProblemDescription = "Heart beats inconsistently or weirdly."; heart.ProblemChildren = new List <ProblemChild>(); heart.ProblemChildren.Add(new ProblemChild { ProblemID = heartAttack.ProblemID }); heart.ProblemChildren.Add(new ProblemChild { ProblemID = arrythmia.ProblemID }); ProblemsModelList breathing = new ProblemsModelList(); breathing.ProblemID = 5; breathing.ProblemName = "Breathing Issues"; breathing.ProblemDescription = "History of breathing issues."; chest.ProblemChildren = new List <ProblemChild>(); chest.ProblemChildren.Add(new ProblemChild { ProblemID = heart.ProblemID }); chest.ProblemChildren.Add(new ProblemChild { ProblemID = breathing.ProblemID }); ProblemsModelList everythingElse = new ProblemsModelList(); everythingElse.ProblemID = 6; everythingElse.ProblemName = "Everything Else"; everythingElse.ProblemDescription = "Any other kind of issue."; parent.ProblemChildren = new List <ProblemChild>(); parent.ProblemChildren.Add(new ProblemChild { ProblemID = everythingElse.ProblemID }); parent.ProblemChildren.Add(new ProblemChild { ProblemID = chest.ProblemID }); Problems.Add(parent); Problems.Add(chest); Problems.Add(heart); Problems.Add(arrythmia); Problems.Add(heartAttack); Problems.Add(breathing); Problems.Add(everythingElse); Patients = new List <PatientInfoModel>(); PatientInfoModel patient = new PatientInfoModel(); patient.PatientData = new PatientDataModel(); patient.PatientData.Address = "1 Main Street"; patient.PatientData.Birthdate = DateTime.Now.ToShortDateString(); patient.PatientData.CellPhone = "555-123-1234"; patient.PatientData.City = "Charlotte"; patient.PatientData.Email = "*****@*****.**"; patient.PatientData.EmergencyContactInfo = new List <EmergencyContactInfo>(); patient.PatientData.EmergencyContactInfo.Add(new EmergencyContactInfo { FullName = "Mom Person", Relationship = "Mom", CellPhone = "555-123-2345" }); patient.PatientData.Employer = "A Company"; patient.PatientData.FirstName = "Test"; patient.PatientData.ID = "1"; patient.PatientData.InsuranceInfo = new List <InsuranceModelPatientDetails>(); patient.PatientData.InsuranceInfo.Add(new InsuranceModelPatientDetails { InsuranceID = 1, PlanName = "Plan 1", GroupNumber = "1", EmployeeNumber = "2" }); patient.PatientData.InsuredPerson = new InsuredPerson { InsuredSSN = "123-45-6789", InsuredRelationship = "Self", InsuredBirthdate = DateTime.Now.ToShortDateString() }; patient.PatientData.LastName = "Person"; patient.PatientData.Occupation = "Job"; patient.PatientData.SSN = "123-45-6789"; patient.PatientData.State = "NC"; patient.PatientData.Zip = "12345-6789"; patient.Doctors = new List <DoctorsModelID>(); patient.Doctors.Add(new DoctorsModelID { DoctorID = 1 }); patient.Demographics = new DemographicsModel { City = "Charlotte", EducationLevel = "Bachelor's Degree", Ethnicity = "Prefer Not to Say", Gender = "Prefer Not to Say", GeneralHealthLevel = "Good", MaritalStatus = "Single", State = "NC", Zip = "12345-6789" }; patient.History = null; Patients.Add(patient); }