public static WeatherReportRequestModel ToModel(this WeatherReportByCityNamerequest request)
 {
     return(new WeatherReportRequestModel
     {
         CityName = request.CityName
     });
 }
예제 #2
0
        public WeatherReportResponse GetReportByCityName(WeatherReportByCityNamerequest request)
        {
            Validation.EnsureValid(request, new WeatherReportByCityNameRequestValidator());

            var requestModel = request.ToModel();

            //Here we will call the core service
            var responseModel = weatherApp.GetWeatherReport(requestModel);

            //Convert back the model to data contract

            return(responseModel.ToDataContract());
        }
        public IActionResult GetReportByCityName([FromBody] WeatherReportByCityNamerequest request)
        {
            var response = WeatherAppService.GetReportByCityName(request);

            return(Ok(response));
        }