Ejemplo n.º 1
0
 public ActionResult SaveTourSettings(EditTourViewModel viewModel)
 {
     //model cannot be invalid (?)
     //tourNumber in TourDto not set
     _tourService.UpdateTour(viewModel.TourDto);
     return(RedirectToAction("EditTour", new { tourId = viewModel.TourDto.TourId }));
 }
Ejemplo n.º 2
0
        public object CreateViewModel(DependencyObject sender)
        {
            EditTourViewModel vm      = new EditTourViewModel(TourSingleton.GetInstance.EditTour);
            ITourDal          tourDal = new TourDal(ConfigurationManager.AppSettings["connection_string"]);

            vm.ServiceLocator.RegisterService <ITourService>(new TourService(tourDal));
            vm.ServiceLocator.RegisterService <IMapService>(new MapquestService(ConfigurationManager.AppSettings["base_directory"]));
            return(vm);
        }
Ejemplo n.º 3
0
        public ActionResult AddMatches(EditTourViewModel viewModel)
        {
            var possibleTeams    = _teamService.GetLastTournamentTeams();
            var inputMatchesInfo = viewModel.SubmitTextArea.InputText;

            if (inputMatchesInfo.IsNullOrEmpty())
            {
                return(RedirectToAction("EditTour", new { tourId = viewModel.SubmitTextArea.TourId }));
            }

            var parsingResult = _fileService.ParseTourSchedule(inputMatchesInfo);
            var matches       = _matchService.CreateMatches(parsingResult, possibleTeams, viewModel.SubmitTextArea.TourId);

            _matchService.AddMatches(matches);
            return(RedirectToAction("EditTour", new { tourId = viewModel.SubmitTextArea.TourId }));
        }
Ejemplo n.º 4
0
        public ActionResult AddMatch(EditTourViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("EditTour", new { tourId = viewModel.TourDto.TourId }));
            }

            var match = new Match(
                viewModel.InputDate,
                viewModel.SelectedHomeTeamId,
                viewModel.SelectedAwayTeamId,
                viewModel.TourDto.TourId);

            _matchService.AddMatch(match);
            return(RedirectToAction("EditTour", new { tourId = viewModel.TourDto.TourId }));
        }