コード例 #1
0
        public async Task <IActionResult> GetDrugBySyptomId(int symptomId)
        {
            if (symptomId > 0)
            {
                var AllDrug = await _diag.GetDrugBySyptomId(symptomId);

                //  var allBulletinMapped = _mapper.Map<TreatmentBulletinForReturnDto>(allBulletin);

                List <DrugForReturnDto> AllDrugs = new List <DrugForReturnDto>();
                foreach (var item in AllDrug)
                {
                    var allMapped = new DrugForReturnDto();
                    allMapped.DrugName          = item.Drug.DrugName;
                    allMapped.DrugId            = item.DrugId;
                    allMapped.TreatmentBulletin = _mapper.Map <TreatmentBulletinForCreationDto>(item.Drug.TreatmentBulletin);
                    AllDrugs.Add(allMapped);
                }
                return(Ok(AllDrugs));
            }
            return(BadRequest("Pleas Enter Valid Id"));
        }