Exemplo n.º 1
0
 public MatchGoal EditMatchGoal(MatchGoal thisMatchGoal)
 {
     if (_context.Match_Goals.Find(thisMatchGoal.Id) != null)
     {
         var updatedMatchGoal = _context.Match_Goals.Attach(thisMatchGoal);
         updatedMatchGoal.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
         _context.SaveChanges();
         return(thisMatchGoal);
     }
     return(thisMatchGoal);
 }
Exemplo n.º 2
0
 public int Insert(MatchGoal matchGoal)
 {
     return(Add(INSERT, new Dictionary <string, object>
     {
         { "matchId", matchGoal.MatchId },
         { "teamId", matchGoal.TeamId },
         { "minute", matchGoal.Minute },
         { "playerId", matchGoal.PlayerId },
         { "assistPlayerId", matchGoal.AssistPlayerId },
         { "ownGoal", matchGoal.OwnGoal }
     }));
 }
Exemplo n.º 3
0
        // Primitive
        private void CreateGoalRecord(int matchId, int teamId)
        {
            var minute         = Utilities.Utilities.GetRandomNumber(1, 90);
            var playerId       = _playerService.GetRandomPlayerFromTeam(teamId, false);
            var assistPlayerId = _playerService.GetRandomPlayerFromTeam(teamId);

            if (playerId == assistPlayerId)
            {
                assistPlayerId = 0;
            }
            var ownGoal = false;

            var matchGoal = new MatchGoal
            {
                MatchId        = matchId,
                TeamId         = teamId,
                PlayerId       = playerId,
                AssistPlayerId = assistPlayerId,
                Minute         = minute,
                OwnGoal        = ownGoal // TODO - some of these
            };

            _matchGoalService.Insert(matchGoal);

            if (!ownGoal)
            {
                var playerStats = _playerStatsService.Get(playerId);
                playerStats.Goals++;
                _playerStatsService.Update(playerStats);
            }

            if (assistPlayerId > 0)
            {
                var playerAssistStats = _playerStatsService.Get(assistPlayerId);
                playerAssistStats.Assists++;
                _playerStatsService.Update(playerAssistStats);
            }
        }
Exemplo n.º 4
0
 public int Insert(MatchGoal matchGoal)
 {
     return(_matchGoalQuery.Insert(matchGoal));
 }
Exemplo n.º 5
0
 public MatchGoal AddMatchGoal(MatchGoal matchGoal)
 {
     _context.Match_Goals.Add(matchGoal);
     return(matchGoal);
 }