Esempio n. 1
0
        public async Task <bool> UpdateScore(UpdateMatchScoreViewModel model)
        {
            var match = await _dbContext.Matches.FirstOrDefaultAsync(m => m.Id == model.Id);

            if (match == null)
            {
                return(false);
            }

            match.TeamAScore = model.TeamAScore;
            match.TeamBScore = model.TeamBScore;

            _dbContext.Entry(match).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync();

            return(true);
        }
        public async Task <IActionResult> Put([FromBody] UpdateMatchScoreViewModel model)
        {
            var success = await _matchService.UpdateScore(model);

            return(Json(success));
        }