public ActionResult GroupTestUpdateById(int idGroupTest) { GroupTestUIModel groupTestUIModel = new GroupTestUIModel(); MedicalTestBL medicalTestBL = new MedicalTestBL(); var config = new MapperConfiguration(cfg => { cfg.CreateMap<GroupTestModelBL, GroupTestUIModel>(); }); IMapper iMapper = config.CreateMapper(); groupTestUIModel = iMapper.Map<GroupTestModelBL, GroupTestUIModel>(medicalTestBL.GroupTestUpdateById(idGroupTest)); List<SelectListItem> selectTestListDDL = medicalTestBL.TestCategoryFormList().Select(x => new SelectListItem { Value = x.idTestCategory.ToString(), Text = x.TestCategoryName }).ToList(); selectTestListDDL.Insert(0, new SelectListItem { Text = "Select", Value = "" }); groupTestUIModel = new GroupTestUIModel() { selectTestCategoryType = selectTestListDDL }; return View("GroupTestForm", groupTestUIModel); }
// Don't do this: // groupTestUIModel = new GroupTestUIModel() // { // selectTestCategoryType = selectTestListDDL // }; // Instead, do this: groupTestUIModel.selectTestCategoryType = selectTestListDDL;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)