Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 public IList <TrainView> GetTrains()
 {
     return(_train.GetAllTrains());;
 }