public void CreateMedicineWithDescription(MedicineInformationDto medicineWithQuantityDto) { MedicineInformation medicineWithQuantity = GetAll().SingleOrDefault(medicineName => medicineName.MedicineDescription.Name.Equals(medicineWithQuantityDto.MedicineDescription.Name)); if (medicineWithQuantity != null) { MedicineWithQuantityRepository.UpdateDescription(medicineWithQuantity, medicineWithQuantityDto.MedicineDescription.Description); } else { Create(medicineWithQuantityDto); } }
private static bool CheckMedicineNameEquality(MedicineInformationDto dto, MedicineInformation MedicineWithQuantity) { return(MedicineWithQuantity.MedicineDescription.Name.Equals(MedicineInformationAdapter.MedicineWithQuantityDtoToMedicineWithQuantity(dto).MedicineDescription.Name)); }
public MedicineInformation CreateIMedicineDescription(MedicineInformationDto dto) { MedicineInformation medicineWithQuantity = _medicineWithQuantityRepository.GetAll().SingleOrDefault(medicine => CheckMedicineNameEquality(dto, medicine)); return(medicineWithQuantity == null ? MedicineInformationAdapter.MedicineWithQuantityDtoToMedicineWithQuantity(dto) : null); }
public MedicineInformation Create(MedicineInformationDto medicineWithQuantityDto) { return(MedicineWithQuantityRepository.Create(MedicineInformationAdapter.MedicineWithQuantityDtoToMedicineWithQuantity(medicineWithQuantityDto))); }