public IActionResult Persistir([FromBody] ForecastVM forecastVM) { try { var forecast = Mapper.Map <ForecastET>(forecastVM); forecast.ValorForecast.Usuario = _variables.UsuarioToken; if (forecastVM.Id == 0) { _forecastService.Adicionar(forecast); } else if (forecastVM.Id == 1) { _forecastService.Atualizar(forecast); } return(Ok(true)); } catch (ArgumentException ex) { return(StatusCode(409, ex.Message)); } catch (Exception ex) { return(BadRequest()); } }