public async Task <IActionResult> Put(int id, [FromBody] SuperheroUpdateDTO superhero) { var response = await _repository.UpdateAsync(superhero); return(response switch { Updated => NoContent(), Lecture10.Models.Response.NotFound => NotFound(), _ => throw new NotSupportedException(), // <- can't happen });
public async Task <IActionResult> Put(int id, [FromBody] SuperheroUpdateDTO superhero) { var response = await _repository.UpdateAsync(superhero); switch (response) { case Updated: return(NoContent()); case BDSA2019.Lecture09.Models.Response.NotFound: return(NotFound()); default: throw new NotSupportedException(); // <- can't happen } }