Beispiel #1
0
        public List <MedicationDto> GetAll()
        {
            List <MedicationDto> myMedications = new List <MedicationDto>();

            _dbContext.Medications.ToList().ForEach(medication => myMedications.Add(MedicationAdapter.MedicationToMedicationDto(medication)));

            return(myMedications);
        }
Beispiel #2
0
        public MedicationDto GetById(int medicationId)
        {
            Medication myMedication = _dbContext.Medications.SingleOrDefault(medication => medication.Id == medicationId);

            if (myMedication == null)
            {
                return(null);
            }

            return(MedicationAdapter.MedicationToMedicationDto(myMedication));
        }