public Guid Execute(CreatePatientModel model) { var firstName = PatientFirstName.Create(model.FirstName); var middleName = PatientMiddleName.Create(model.MiddleName); var lastName = PatientLastName.Create(model.LastName); var dateOfBirth = PatientDateOfBirth.Create(model.DateOfBirth); var placeOfBirth = PatientPlaceOfBirth.Create(model.PlaceOfBirth); var sex = PatientSex.Create(model.Sex); var occupation = PatientOccupation.Create(model.Occupation); var patientType = PatientType.Create(model.PatientType); var patient = Patient.Create(firstName, middleName, lastName, dateOfBirth, placeOfBirth, occupation, sex, patientType); _databaseService.PatientsRepository.Add(patient); return(patient.Id); }
public void Execute(UpdatePatientModel model) { var dateOfBirth = PatientDateOfBirth.Create(model.DateOfBirth); var sex = PatientSex.Create(model.Sex); var patientType = PatientType.Create(model.PatientType); var firstName = PatientFirstName.Create(model.FirstName); var middleName = PatientMiddleName.Create(model.MiddleName); var lastName = PatientLastName.Create(model.LastName); var occupation = PatientOccupation.Create(model.Occupation); var placeOfBirth = PatientPlaceOfBirth.Create(model.PlaceOfBirth); var patient = _databaseService.PatientsRepository.GetById(model.Id); patient.FirstName = firstName; patient.MiddleName = middleName; patient.LastName = lastName; patient.DateOfBirth = dateOfBirth; patient.PatientType = patientType; patient.Occupation = occupation; patient.PlaceOfBirth = placeOfBirth; patient.Sex = sex; _databaseService.PatientsRepository.Update(patient); }