// GET: AcademicTitle public ActionResult Index() { IEnumerable <AcademicTitleDTO> academicTitleDTOs = academicTitleService.GetAcademicTitles(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <AcademicTitleDTO, AcademicTitleViewModel>()).CreateMapper(); var academicTitles = mapper.Map <IEnumerable <AcademicTitleDTO>, List <AcademicTitleViewModel> >(academicTitleDTOs); return(View(academicTitles)); }
public ActionResult CreateEmployee() { IEnumerable <AcademicDegreeDTO> academicDegreeDTOs = academicDegreeService.GetAcademicDegrees(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <AcademicDegreeDTO, AcademicDegreeViewModel>()).CreateMapper(); var academicDegrees = mapper.Map <IEnumerable <AcademicDegreeDTO>, List <AcademicDegreeViewModel> >(academicDegreeDTOs); SelectList academicDegreesList = new SelectList(academicDegrees, "Id", "Title"); ViewBag.AcademicDegrees = academicDegreesList; IEnumerable <AcademicTitleDTO> academicTitleDTOs = academicTitleService.GetAcademicTitles(); mapper = new MapperConfiguration(cfg => cfg.CreateMap <AcademicTitleDTO, AcademicTitleViewModel>()).CreateMapper(); var academicTitles = mapper.Map <IEnumerable <AcademicTitleDTO>, List <AcademicTitleViewModel> >(academicTitleDTOs); SelectList academicTitlesList = new SelectList(academicTitles, "Id", "Title"); ViewBag.AcademicTitles = academicTitlesList; return(View()); }