Beispiel #1
0
        public ActionResult EditTrainDetails(int trainId)       //Editing Train details
        {
            TrainDetails          trainDetails          = trainDetailsBL.GetTrainByNo(trainId);
            TrainDetailsViewModel trainDetailsViewModel = AutoMapper.Mapper.Map <TrainDetails, TrainDetailsViewModel>(trainDetails);

            return(View(trainDetailsViewModel));
        }
Beispiel #2
0
        public virtual ActionResult TrainDetails()
        {
            var model = new TrainDetailsViewModel()
            {
                TrainSettings = evaluator.TrainSettings,
                TrainData     = evaluator.TrainData,
            };

            return(View(model));
        }
Beispiel #3
0
 public ActionResult EditTrainDetails(TrainDetailsViewModel trainDetailsViewModel)   //Post method for editing train details
 {
     if (ModelState.IsValid)
     {
         TrainDetails trainDetails = AutoMapper.Mapper.Map <TrainDetailsViewModel, TrainDetails>(trainDetailsViewModel);
         trainDetailsBL.UpdateTrainDetails(trainDetails);
         TempData["TrainId"] = trainDetails.TrainId;
         return(RedirectToAction("DisplayTrainCategories", "TrainClass"));
     }
     return(View(trainDetailsViewModel));
 }
Beispiel #4
0
        public ActionResult DisplayTrainDetails()
        {
            IEnumerable <TrainDetails>   trainDetailsList          = trainDetailsBL.GetTrainDetails();
            List <TrainDetailsViewModel> trainDetailsViewModelList = new List <TrainDetailsViewModel>();

            //IEnumerable<TrainDetails> trainList = TrainDetailsBL.GetTrainDetails();       //Displaying Train Details
            foreach (TrainDetails train in trainDetailsList)
            {
                TrainDetailsViewModel trainDetailsViewModel = AutoMapper.Mapper.Map <TrainDetails, TrainDetailsViewModel>(train);
                trainDetailsViewModelList.Add(trainDetailsViewModel);
            }
            return(View(trainDetailsViewModelList));
        }
        public ActionResult DisplayTrainDetails(SearchTrainViewModel searchTrainViewModel)  //based on search result displaying train
        {
            TempData["JourneyDate"] = searchTrainViewModel.JourneyDate;
            List <TrainDetails>          trainDetailsList          = trainDetailsBL.SearchTrain(searchTrainViewModel.Source, searchTrainViewModel.Destination); //fetching train details list based in search result
            List <TrainDetailsViewModel> trainDetailsViewModelList = new List <TrainDetailsViewModel>();

            //IEnumerable<TrainDetails> trainList = TrainDetailsBL.GetTrainDetails();       //Displaying Train Details
            foreach (TrainDetails train in trainDetailsList)
            {
                TrainDetailsViewModel trainDetailsViewModel = AutoMapper.Mapper.Map <TrainDetails, TrainDetailsViewModel>(train);    //Automapping of objects
                trainDetailsViewModelList.Add(trainDetailsViewModel);
            }
            return(View(trainDetailsViewModelList));
        }
        public ActionResult Train(int id)
        {
            var startDate = DateTime.Now;
            var endDate   = startDate.AddMonths(1);
            var model     = new TrainDetailsViewModel()
            {
                ScheduleStart  = startDate,
                ScheduleEnd    = endDate,
                Runs           = _runRepo.GetRuns(startDate, endDate, id),
                Train          = _trainRepo.GetTrainDetails(id),
                AvailableDates = _schedule.GetAvailableDatesForNewRun(id, startDate, endDate)
            };

            return(View(model));
        }
Beispiel #7
0
 public ActionResult Create(TrainDetailsViewModel trainDetailsViewModel)
 {
     if (ModelState.IsValid)
     {
         TrainDetails trainDetails = AutoMapper.Mapper.Map <TrainDetailsViewModel, TrainDetails>(trainDetailsViewModel);
         //trainDetails.TrainClassDetails = new List<TrainClassDetails>();
         //foreach(int detail in trainDetailsViewModel.TrainClass)
         //{
         //    TrainClassDetails trainClassDetails = new TrainClassDetails();
         //    trainClassDetails.ClassId = detail;
         //    trainDetails.TrainClassDetails.Add(trainClassDetails);
         //}
         trainDetailsBL.AddTrainDetails(trainDetails);                       //Creating Train Details
         TempData["TrainId"] = trainDetails.TrainId;
         return(RedirectToAction("AddTrainClass", "TrainClass"));
         //TempData["Message"] = "Added Successfully!!!";
         //return RedirectToAction("Index");
     }
     //ViewBag.TrainClass = new SelectList(TrainClassRepository.GetClassDetails(), "ClassId", "ClassName");
     return(View(trainDetailsViewModel));
 }
Beispiel #8
0
        public virtual ActionResult Details(string id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            var trainSettings = trainStorageManager.LoadTrainSettings(id);

            if (trainSettings == null)
            {
                return(HttpNotFound());
            }

            var model = new TrainDetailsViewModel()
            {
                TrainSettings = trainSettings,
                TrainData     = isJobRunning(id) ? null : trainStorageManager.LoadTrainData(id),
            };

            return(View(model));
        }