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

            if (id != club.Id)
            {
                return(BadRequest());
            }

            repo.Update(club);

            try
            {
                await repo.SaveAllChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!await repo.ClubExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }