コード例 #1
0
        public async Task <IActionResult> GetAllDrugs()
        {
            var AllDrugs = await _diag.GetAllDrugs();

            //  var AllDrugsMapped = _mapper.Map<DrugForReturnDto>(AllDrugs);
            List <DrugForReturnDto> AllDrugsMapped = new List <DrugForReturnDto>();

            foreach (var item in AllDrugs)
            {
                var allMapped = new DrugForReturnDto();
                allMapped.DrugName          = item.DrugName;
                allMapped.DrugId            = item.DrugId;
                allMapped.TreatmentBulletin = _mapper.Map <TreatmentBulletinForCreationDto>(item.TreatmentBulletin);
                // allMapped.TreatmentBulletin.Composition = item.TreatmentBulletin.Composition;
                // allMapped.TreatmentBulletin.Dosing = item.TreatmentBulletin.Dosing;
                // allMapped.TreatmentBulletin.Indications = item.TreatmentBulletin.Indications;
                // allMapped.TreatmentBulletin.SideEffects = item.TreatmentBulletin.SideEffects;
                AllDrugsMapped.Add(allMapped);
            }
            return(Ok(AllDrugsMapped));
            //  return Ok(AllDrugsMapped);
        }