Exemplo n.º 1
0
        public async Task <IActionResult> PutHistoricoPartida([FromRoute] int id, [FromBody] HistoricoPartida historicoPartida)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != historicoPartida.HistoricoPartidaId)
            {
                return(BadRequest());
            }

            _context.Entry(historicoPartida).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HistoricoPartidaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutTipoJogo([FromRoute] int id, [FromBody] TipoJogo tipoJogo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tipoJogo.TipoJogoId)
            {
                return(BadRequest());
            }

            _context.Entry(tipoJogo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TipoJogoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }