public IActionResult Edit(int id) { var groupDrug = _groupDrugService.GetById(id); var model = _mapper.Map <GroupDrugViewModelEdit>(groupDrug); return(View(model)); }
public ViewResult Index() { var drugs = _drugService.GetAll(); var model = _mapper.Map <IEnumerable <DrugViewModel> >(drugs); foreach (var i in model) { if (i.ProducerId != null) { i.ProducerName = _producerService.GetById((int)i.ProducerId).Name; } if (i.GroupDrugId != null) { i.GroupDrugName = _groupDrugService.GetById((int)i.GroupDrugId).Name; } } return (View(model)); }