Пример #1
0
        public ActionResult ImportMatchDetails(ImportMatchDetailsViewModel importMatchDetailsViewModel)
        {
            var soccerbase = new Soccerbase(DbProvider, User);

            soccerbase.LogFilePath = this.LogFilePath;

            soccerbase.Import(importMatchDetailsViewModel.StartDate, importMatchDetailsViewModel.EndDate);

            return(RedirectToAction("ImportMatchDetails", new { sd = importMatchDetailsViewModel.StartDate.ToUrlString(), ed = importMatchDetailsViewModel.EndDate.ToUrlString() }));
        }
Пример #2
0
        public async Task <ActionResult> MatchValidation(CompetitionMatchValidationViewModel viewModel)
        {
            await SetModelsByPrimaryKey(viewModel);

            viewModel.SetCampaigns();

            if (viewModel.FixMatchesWithoutVenues)
            {
                var matchesWithoutVenues = await DbProvider.GetMatchesWithoutVenues(viewModel.SelectedCampaignViewModel.Entity.PrimaryKey, viewModel.ViewDate);

                foreach (var matchViewModel in matchesWithoutVenues)
                {
                    var team1 = matchViewModel.VersionEntity.Team1.GetApprovedVersion <TeamV>(matchViewModel.VersionEntity.MatchDate);

                    if (team1.HomeVenueGuid != null)
                    {
                        matchViewModel.VersionEntity.VenueGuid = team1.HomeVenueGuid;
                    }
                }
            }

            if (viewModel.FixMatchesWithoutEvents > 0)
            {
                viewModel.MatchDatesWithoutEvents = await DbProvider.GetMatchDatesWithoutEvents(viewModel.SelectedCampaignViewModel.Entity.PrimaryKey);

                var soccerbase = new Soccerbase(DbProvider, User);

                foreach (DateTime matchDate in viewModel.MatchDatesWithoutEvents.Take(viewModel.FixMatchesWithoutEvents))
                {
                    await soccerbase.Import(matchDate, matchDate);
                }
            }

            DbProvider.SaveChanges();

            return(RedirectToAction("MatchValidation", new { hk = viewModel.ShortHeaderKey, dt = viewModel.ViewDate.ToUrlString() }));
        }