Example #1
0
        public JsonResult AddUpdateData(Fixture_VM Model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    GetUserInfo(Model);

                    if (Model.FixtureID == 0 || Model.FixtureID == null)
                    {
                        var data = _FixtureRepo.Add(Model);
                        return(GetAddEditDeleteResponse(data, "Add"));
                    }
                    else if (Model.FixtureID > 0)
                    {
                        var data = _FixtureRepo.Update(Model);
                        return(GetAddEditDeleteResponse(data, "Update"));
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("FixtureController_AddUpdateData Error: ", ex);
                    return(GetAddEditErrorException(ex));
                }
            }
            return(GetModelStateIsValidException(ViewData));
        }
Example #2
0
        public async Task ProcessMatchInfo(FixtureMatchInfo matchInfo, IDbConnection conn)
        {
            var teams = new List <Entities.Team>
            {
                new Entities.Team
                {
                    Id        = matchInfo.HomeTeamId,
                    Name      = matchInfo.HomeTeamName,
                    ShortName = string.Empty
                },
                new Entities.Team
                {
                    Id        = matchInfo.AwayTeamId,
                    Name      = matchInfo.AwayTeamName,
                    ShortName = string.Empty
                }
            };
            await _teamRepository.InsertMultipleAsync(teams, conn);

            var details = new Entities.Fixture
            {
                FixtureId          = matchInfo.Id,
                HomeDeep           = matchInfo.HomeDeepPasses,
                AwayDeep           = matchInfo.AwayDeepPasses,
                HomeWinForecast    = matchInfo.HomeWinForecast,
                DrawForecast       = matchInfo.DrawForecast,
                AwayWinForecast    = matchInfo.AwayWinForecast,
                HomePpda           = matchInfo.HomePpda,
                AwayPpda           = matchInfo.AwayPpda,
                AwayExpectedGoals  = matchInfo.AwayExpectedGoals,
                AwayExpectedPoints = matchInfo.AwayWinForecast * 3 + matchInfo.DrawForecast,
                AwayGoals          = matchInfo.AwayGoals,
                AwayShots          = matchInfo.AwayShots,
                AwayShotsOnTarget  = matchInfo.AwayShotsOnTarget,
                HomeExpectedGoals  = matchInfo.HomeExpectedGoals,
                HomeExpectedPoints = matchInfo.HomeWinForecast * 3 + matchInfo.DrawForecast,
                HomeGoals          = matchInfo.HomeGoals,
                HomeShots          = matchInfo.HomeShots,
                HomeShotsOnTarget  = matchInfo.HomeShotsOnTarget
            };

            await _fixtureRepository.Update(details, conn);
        }
 public void UpdateFixture(Fixture fixture)
 {
     fixtureRepository.Update(fixture);
 }