Commit f55bf66c authored by Almouhannad's avatar Almouhannad

(B) Edit result errors

parent c4245ed6
...@@ -65,7 +65,7 @@ public sealed class Medicine : Entity ...@@ -65,7 +65,7 @@ public sealed class Medicine : Entity
selectedMedicineForm = Result.Success<MedicineForm>(syrup); selectedMedicineForm = Result.Success<MedicineForm>(syrup);
if (selectedMedicineForm.IsFailure) if (selectedMedicineForm.IsFailure)
return Result.Failure<Medicine>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<Medicine>(selectedMedicineForm.Error);
#endregion #endregion
return new Medicine(0, selectedMedicineForm.Value, amount, name, dosage); return new Medicine(0, selectedMedicineForm.Value, amount, name, dosage);
......
...@@ -46,7 +46,7 @@ public sealed class Doctor : Entity ...@@ -46,7 +46,7 @@ public sealed class Doctor : Entity
{ {
Result<PersonalInfo> personalInfo = PersonalInfo.Create(firstName, middleName, lastName); Result<PersonalInfo> personalInfo = PersonalInfo.Create(firstName, middleName, lastName);
if (personalInfo.IsFailure) if (personalInfo.IsFailure)
return Result.Failure<Doctor>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<Doctor>(personalInfo.Error);
return new Doctor(0, personalInfo.Value); return new Doctor(0, personalInfo.Value);
} }
...@@ -58,7 +58,7 @@ public sealed class Doctor : Entity ...@@ -58,7 +58,7 @@ public sealed class Doctor : Entity
#region Create number to attach #region Create number to attach
Result<DoctorPhone> doctorPhone = DoctorPhone.Create(phone, name); Result<DoctorPhone> doctorPhone = DoctorPhone.Create(phone, name);
if (doctorPhone.IsFailure) if (doctorPhone.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(doctorPhone.Error);
#endregion #endregion
#region Check duplicate #region Check duplicate
......
...@@ -79,7 +79,7 @@ public sealed class Employee : Entity ...@@ -79,7 +79,7 @@ public sealed class Employee : Entity
#region Create patient #region Create patient
Result<Patient> patient = Patient.Create(firstName, middleName, lastName, dateOfBirth, gender); Result<Patient> patient = Patient.Create(firstName, middleName, lastName, dateOfBirth, gender);
if (patient.IsFailure) if (patient.IsFailure)
return Result.Failure<Employee>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<Employee>(patient.Error);
#endregion #endregion
#region Check employee's required details #region Check employee's required details
...@@ -110,7 +110,7 @@ public sealed class Employee : Entity ...@@ -110,7 +110,7 @@ public sealed class Employee : Entity
Result<EmployeeFamilyMember> employeeFamilyMember = Result<EmployeeFamilyMember> employeeFamilyMember =
EmployeeFamilyMember.Create(Id, familyMember.Id, role); EmployeeFamilyMember.Create(Id, familyMember.Id, role);
if (employeeFamilyMember.IsFailure) if (employeeFamilyMember.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(employeeFamilyMember.Error);
#endregion #endregion
#region Check valid relation #region Check valid relation
......
...@@ -69,7 +69,7 @@ public sealed class EmployeeFamilyMember : Entity ...@@ -69,7 +69,7 @@ public sealed class EmployeeFamilyMember : Entity
selectedRole = Result.Success<FamilyRole>(daughter); selectedRole = Result.Success<FamilyRole>(daughter);
if (selectedRole.IsFailure) if (selectedRole.IsFailure)
return Result.Failure<EmployeeFamilyMember>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<EmployeeFamilyMember>(selectedRole.Error);
#endregion #endregion
......
...@@ -34,7 +34,7 @@ public sealed class FamilyMember : Entity ...@@ -34,7 +34,7 @@ public sealed class FamilyMember : Entity
#region Create patient #region Create patient
Result<Patient> patient = Patient.Create(firstName, middleName, lastName, dateOfBirth, gender); Result<Patient> patient = Patient.Create(firstName, middleName, lastName, dateOfBirth, gender);
if (patient.IsFailure) if (patient.IsFailure)
return Result.Failure<FamilyMember>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<FamilyMember>(patient.Error);
#endregion #endregion
return new FamilyMember(0, patient.Value); return new FamilyMember(0, patient.Value);
......
...@@ -83,7 +83,7 @@ public sealed class Patient : Entity ...@@ -83,7 +83,7 @@ public sealed class Patient : Entity
#region Personal info #region Personal info
Result<PersonalInfo> personalInfo = PersonalInfo.Create(firstName, middleName, lastName); Result<PersonalInfo> personalInfo = PersonalInfo.Create(firstName, middleName, lastName);
if (personalInfo.IsFailure) if (personalInfo.IsFailure)
return Result.Failure<Patient>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<Patient>(personalInfo.Error);
#endregion #endregion
#region Gender #region Gender
...@@ -98,7 +98,7 @@ public sealed class Patient : Entity ...@@ -98,7 +98,7 @@ public sealed class Patient : Entity
selectedGender = Result.Success<Gender>(female); selectedGender = Result.Success<Gender>(female);
if (selectedGender.IsFailure) if (selectedGender.IsFailure)
return Result.Failure<Patient>(Errors.DomainErrors.InvalidValuesError); return Result.Failure<Patient>(selectedGender.Error);
#endregion #endregion
return new Patient(0, personalInfo.Value, dateOfBirth, selectedGender.Value); return new Patient(0, personalInfo.Value, dateOfBirth, selectedGender.Value);
...@@ -112,7 +112,7 @@ public sealed class Patient : Entity ...@@ -112,7 +112,7 @@ public sealed class Patient : Entity
#region Create medicine to attach #region Create medicine to attach
Result<PatientMedicine> entry = PatientMedicine.Create(Id, medicine.Id, number); Result<PatientMedicine> entry = PatientMedicine.Create(Id, medicine.Id, number);
if (entry.IsFailure) if (entry.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(entry.Error);
#endregion #endregion
#region Check duplication #region Check duplication
...@@ -131,7 +131,7 @@ public sealed class Patient : Entity ...@@ -131,7 +131,7 @@ public sealed class Patient : Entity
#region Create disease to attach #region Create disease to attach
Result<PatientDisease> entry = PatientDisease.Create(Id, disease.Id); Result<PatientDisease> entry = PatientDisease.Create(Id, disease.Id);
if (entry.IsFailure) if (entry.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(entry.Error);
#endregion #endregion
#region Check duplication #region Check duplication
......
...@@ -103,7 +103,7 @@ public sealed class Visit : Entity ...@@ -103,7 +103,7 @@ public sealed class Visit : Entity
#region Create medical image to attach #region Create medical image to attach
Result<VisitMedicalImage> entry = VisitMedicalImage.Create(Id, medicalImage.Id); Result<VisitMedicalImage> entry = VisitMedicalImage.Create(Id, medicalImage.Id);
if (entry.IsFailure) if (entry.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(entry.Error);
#endregion #endregion
#region Check duplicate #region Check duplicate
...@@ -122,7 +122,7 @@ public sealed class Visit : Entity ...@@ -122,7 +122,7 @@ public sealed class Visit : Entity
#region Create medical test to attach #region Create medical test to attach
Result<VisitMedicalTest> entry = VisitMedicalTest.Create(Id, medicalTest.Id); Result<VisitMedicalTest> entry = VisitMedicalTest.Create(Id, medicalTest.Id);
if (entry.IsFailure) if (entry.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(entry.Error);
#endregion #endregion
#region Check duplicate #region Check duplicate
...@@ -141,7 +141,7 @@ public sealed class Visit : Entity ...@@ -141,7 +141,7 @@ public sealed class Visit : Entity
#region Create medicine to attach #region Create medicine to attach
Result<VisitMedicine> entry = VisitMedicine.Create(Id, medicine.Id, number); Result<VisitMedicine> entry = VisitMedicine.Create(Id, medicine.Id, number);
if (entry.IsFailure) if (entry.IsFailure)
return Result.Failure(Errors.DomainErrors.InvalidValuesError); return Result.Failure(entry.Error);
#endregion #endregion
#region Check duplicate #region Check duplicate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment