public ActionResult Index() { IEnumerable <TrainDetailDTO> trainDtos = trainService.GetAllTrains(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <TrainDetailDTO, TrainViewModel>()).CreateMapper(); var trains = mapper.Map <IEnumerable <TrainDetailDTO>, List <TrainViewModel> >(trainDtos); ViewBag.IsAdmin = IsAdmin; return(View(trains)); }
public IList <TrainView> GetTrains() { return(_train.GetAllTrains());; }