public async Task <IActionResult> CreateStadium([FromBody] StadiumCreateDto stadiumCreateDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var stadiumToCreate = _mapper.Map <Stadium>(stadiumCreateDto); await _stadiumService.CreateAsync(stadiumToCreate); var stadium = await _stadiumService.GetByIdAsync(stadiumToCreate.Id); var returnStadium = _mapper.Map <StadiumDetailDto>(stadium); return(Ok(returnStadium)); }
public async Task <StadiumDTO> Handle(GetStadiumByIdQuery query, CancellationToken cancellationToken) => await _service.GetByIdAsync(query.Id);