public async Task <IActionResult> GetAllMedicines()
        {
            var medicines = await _medicineRepository.GetAllMedicines();

            if (medicines == null)
            {
                return(NoContent());
            }


            var medicinesResult = new List <MedicineListDto>();

            foreach (var medicine in medicines)
            {
                medicinesResult.Add(new MedicineListDto()
                {
                    Id          = medicine.Id,
                    Name        = medicine.Name,
                    Description = medicine.Description,
                    Manufacture = medicine.Manufacture,
                    Supplier    = medicine.Supplier
                });
            }


            return(Ok(medicinesResult));
        }
Beispiel #2
0
        public IEnumerable <MedicineDto> GetMedicinesForPrescription(int prescriptionId, string filterString)
        {
            var medicineEntities = _medicineRepository.GetAllMedicines().Where(x => x.PrescriptionId == prescriptionId);

            if (!string.IsNullOrEmpty(filterString))
            {
                medicineEntities = medicineEntities.Where(x => x.Name.ToLower().Contains(filterString.ToLower()) ||
                                                          x.ActiveSubstance.ToLower().Contains(filterString.ToLower()) ||
                                                          x.CompanyName.ToLower().Contains(filterString.ToLower()));
            }

            return(_mapper.Map(medicineEntities));
        }
Beispiel #3
0
        public List <MedicineDto> GetAllMedicineForAPrescription(int prescriptionId, string filterString)
        {
            var medicineEntities = mMedicineRepository.GetAllMedicines().Where(x => x.PrescriptionId == prescriptionId).ToList();

            if (!string.IsNullOrEmpty(filterString))
            {
                medicineEntities = medicineEntities
                                   .Where(x => x.ActiveSubstance.Contains(filterString) ||
                                          x.Name.Contains(filterString) ||
                                          x.CompanyName.Contains(filterString)).ToList();
            }
            return(mDtoMapper.Map(medicineEntities));
        }
Beispiel #4
0
        public List <MedicineDTO> GetAllMedicineForAPrescription(int prescriptionId, string filterstring)
        {
            var medicineEntities = _medicineRepository.GetAllMedicines().Where(x => x.PrescriptionId == prescriptionId).ToList();

            if (!string.IsNullOrEmpty(filterstring))
            {
                medicineEntities = medicineEntities
                                   .Where(x => x.Name.ToLower().Contains(filterstring.ToLower()) ||
                                          x.ActiveSubstance.ToLower().Contains(filterstring.ToLower()) ||
                                          x.Producent.ToLower().Contains(filterstring.ToLower())).ToList();
            }
            return(_DTOMappers.Map(medicineEntities));
        }
 public async Task <IEnumerable <Medicine> > GetMedicinesAsync()
 {
     return(await _medicineRepository.GetAllMedicines());
 }
 public IEnumerable <Medicine> GetAllMedicines()
 {
     return(_repository.GetAllMedicines());
 }
Beispiel #7
0
 public IActionResult Get()
 {
     return(Ok(_medicineRepository.GetAllMedicines()));
 }
 public List <Medicine> GetAllMedicines()
 {
     return(_repository.GetAllMedicines());
 }