Example #1
0
        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);
            }
        }
Example #2
0
 private static bool CheckMedicineNameEquality(MedicineInformationDto dto, MedicineInformation MedicineWithQuantity)
 {
     return(MedicineWithQuantity.MedicineDescription.Name.Equals(MedicineInformationAdapter.MedicineWithQuantityDtoToMedicineWithQuantity(dto).MedicineDescription.Name));
 }
Example #3
0
        public MedicineInformation CreateIMedicineDescription(MedicineInformationDto dto)
        {
            MedicineInformation medicineWithQuantity = _medicineWithQuantityRepository.GetAll().SingleOrDefault(medicine => CheckMedicineNameEquality(dto, medicine));

            return(medicineWithQuantity == null ? MedicineInformationAdapter.MedicineWithQuantityDtoToMedicineWithQuantity(dto) : null);
        }
Example #4
0
 public MedicineInformation Create(MedicineInformationDto medicineWithQuantityDto)
 {
     return(MedicineWithQuantityRepository.Create(MedicineInformationAdapter.MedicineWithQuantityDtoToMedicineWithQuantity(medicineWithQuantityDto)));
 }