예제 #1
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 }));
        }