public async Task <IActionResult> PutAsync(long id, [FromBody] TerrenoVM terreno, CancellationToken cancellationToken) { var request = Mapper.Map <AtualizaTerrenoRequest>(terreno); request.Id = id; var response = await StrategyContext.HandlerAsync <AtualizaTerrenoRequest, DefaultResponse>(request, cancellationToken); if (!response.IsNotDefault) { return(await ApiResponseAsync(NotFound())); } return(await ApiResponseAsync(NoContent())); }
public async Task <IActionResult> PostAsync([FromBody] TerrenoVM terreno, CancellationToken cancellationToken) { var response = await StrategyContext.HandlerAsync <CadastraTerrenoRequest, CadastraTerrenoResponse>(Mapper.Map <CadastraTerrenoRequest>(terreno), cancellationToken); return(await ApiResponseAsync(Created($"api/v1/terreno/{response?.IdTerreno}", terreno))); }