Commit f55bf66c authored by Almouhannad's avatar Almouhannad

(B) Edit result errors

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