public void CanAddNewPatient() { var repo = new PatientRepository(); var patient = new Patient { Address = new Address { Street1 = "123 Main Street", City = "Accra", Region = "Greater Accra", //Country = "Ghana", IsActive = true }, //Allergies = new List<Allergy> {new Allergy {Name = "Peanut Butter"}}, DateOfBirth = new DateTime(1980, 03, 17), //BloodType = "O+", Gender = Gender.Male, FirstName = "Matthew", MiddleName = "Scott", LastName = "Kimber", EmergencyContact = new EmergencyContact { FirstName = "Jan", LastName = "Kimber", PhoneNumber = "801-479-1717", Relationship = Relationship.Mother, Address = new Address { Street1 = "1288 E. 4790 N.", City = "Ogden", Region = "Utah", //Country = "USA" } }, PhoneNumber = "801-726-8585" //Religion = "Muslim", //TribeRace = "Anglo-Saxon" }; repo.Add(patient); UnitOfWork.CurrentSession.Flush(); UnitOfWork.CurrentSession.Clear(); repo.Get(100002); }
public ActionResult Create(CreatePatientViewModel model) { Address PatientAddress = new Address { Street1 = model.Street1, Street2 = model.Street2, City = model.City, Region = model.Region, Country = model.Country, IsActive = true }; _addressRepository.Add(PatientAddress); Address ECAddress = new Address { Street1 = model.EcStreet1, City = model.EcCity, Region = model.EcRegion, Country = model.EcCountry, IsActive = true }; _addressRepository.Add(ECAddress); var patient = new Patient { FirstName = model.FirstName, MiddleName = model.MiddleName, LastName = model.LastName, PhoneNumber = model.PhoneNumber, PlaceOfBirth = model.PlaceOfBirth, DateOfBirth = model.DateOfBirth, DateOfDeath = DateTime.MinValue, MaritalStatus = model.SelectedMaritalStatus, Gender = model.SelectedGender, Tribe = model.SelectedTribe, Race = model.SelectedRace, Occupation = model.pOccupation, Education = model.SelectedEducation, Religion = model.SelectedReligion, InsuranceNumber = model.InsuranceNumber, OldPhysicalRecordNumber = model.OldPhysicalRecordNumber, CreationDate = DateTime.Now, Address = PatientAddress, EmergencyContact = new EmergencyContact { FirstName = model.EcFirstName, LastName = model.EcLastName, PhoneNumber = model.EcPhoneNumber, Relationship = model.EcRelationship, Address = ECAddress, IsActive = true }, IsActive = true }; //add insurance expiration if it's been set if (model.InsuranceExpiration != DateTime.MinValue) { patient.InsuranceExpiration = model.InsuranceExpiration; } _patientRepository.Add(patient); UnitOfWork.CurrentSession.Flush(); return RedirectToAction("Confirmation", new { id = patient.Id }); }
public PatientViewModel(int patientId) { _patient = new PatientRepository().Get(patientId); }