コード例 #1
0
        public IActionResult AddWeather(Weather weather)
        {
            try
            {
                if (weather == null)
                {
                    return(BadRequest("Data is null."));
                }

                Weather addedWeather = localWeatherRepository.AddWeather(weather);
                return(StatusCode(StatusCodes.Status201Created, addedWeather));
            }
            catch (Exception ex)
            {
                Errors errors = ErrorsHelper.GetErrors(ex);
                return(StatusCode(StatusCodes.Status500InternalServerError, errors));
            }
        }