public async Task <IActionResult> PutMatch(int matchId, [FromBody] UpdateMatch match)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await _matchService.UpdateAsyncMatch(matchId, match);

            return(NoContent());
        }
Beispiel #2
0
        public async Task UpdateAsyncMatch(int id, UpdateMatch matchData)   //metoda edytujaca dane meczu
        {
            var match = await _matchRepository.GetAsyncMatch(id);

            if (match == null)
            {
                throw new Exception($"Match with this id {id} does not exist");
            }
            match.SetNameOpponentTeam(matchData.OpponentTeam);
            match.SetMatchDate(matchData.MatchDate);
            match.SetPlace(matchData.Place);
            match.SetScoreFirstTeam(matchData.ScoreFirstTeam);
            match.SetScoreSecondTeam(matchData.ScoreSecondTeam);
            await _matchRepository.UpdateAsyncMatch(match);
        }