Example #1
0
        public async Task <H2HViewModel> PrepareViewModel(int hometeamId, int awayTeamId)
        {
            var viewModel = new H2HViewModel();

            viewModel.HomeTeamWins = await this.HomeTeamWins(hometeamId, awayTeamId);

            viewModel.AwayTeamWins = await this.AwayTeamWins(hometeamId, awayTeamId);

            viewModel.Draws = await this.Draws(hometeamId, awayTeamId);

            viewModel.TotalGoalsScored = await this.TotalGoalsScored(hometeamId, awayTeamId);

            viewModel.TotalGamesBetweenTwoTeams = await this.TotalGamesBetweenTwoTeams(hometeamId, awayTeamId);

            viewModel.TotalGoalsHomeTeamScored = await this.TotalGoalsHomeTeamScored(hometeamId, awayTeamId);

            viewModel.TotalGoalsAwayTeamScored = await this.TotalGoalsAwayTeamScored(hometeamId, awayTeamId);

            viewModel.TotalBttsLast20GamesHomeTeam = await this.TotalBothTeamsScoredInLast20Games(hometeamId);

            viewModel.TotalBttsLast20GamesAwayTeam = await this.TotalBothTeamsScoredInLast20Games(awayTeamId);

            viewModel.TotalOver2point5GoalsInLast20GamesHomeTeam = await this.TotalOver2point5GoalsInLast20Games(hometeamId);

            viewModel.TotalOver2point5GoalsInLast20GamesAwayTeam = await this.TotalOver2point5GoalsInLast20Games(awayTeamId);

            viewModel.HowOftenTeamWinsAsAHomeTeam = await this.HowOftenTeamWinsAsAHomeTeam(hometeamId);

            viewModel.HowOftenTeamWinsAsAnAwayTeam = await this.HowOftenTeamWinsAsAnAwayTeam(awayTeamId);

            return(viewModel);
        }
Example #2
0
        public async Task <IActionResult> Head2Head(int fixtureId, int hometeamId, int awayTeamId)
        {
            H2HViewModel viewModel = await this.h2HService.PrepareViewModel(hometeamId, awayTeamId);

            viewModel.TeamsDetails = await this.fixturesService.GetH2HTeamsInfo(fixtureId);

            viewModel.Fixtures = await this.fixturesService.GetHead2Head(hometeamId, awayTeamId);

            return(this.View(viewModel));
        }
Example #3
0
        public IActionResult Details(string p1, string p2, string sender)
        {
            // Call the RPC service
            const string host = "localhost";
            const int    port = 50051;

            var serviceUrl = host + ":" + port;
            var channel    = new Channel(serviceUrl, ChannelCredentials.Insecure);
            var client     = new Tennis.H2H.H2HClient(channel);

            var request = new H2HRequest()
            {
                Player1 = p1, Player2 = p2
            };
            var response = sender == "detailsdemo"
                ? client.DetailsDemo(request)
                : client.Details(request);

            var model = new H2HViewModel {
                Player1 = p1, Player2 = p2, Won1 = response.Won1, Won2 = response.Won2
            };

            return(View(model));
        }