public ForecastResponseDto ForecastData(string city) { try { var content = _queryLoader.LoadData(RequestPath(city)); var xelement = XElement.Parse(content); return(new ForecastResponseDto { Success = true, Items = xelement.Element("forecast").Elements().Select(ParseNode) }); } catch (Exception ex) { return(new ForecastResponseDto { Success = false, Message = ex.Message, Items = new List <ForecastDto>() }); } }
public ForecastResponseDto ForecastData(String city) { try { var content = _queryLoader.LoadData(RequestPath(city)); XElement xelement = XElement.Parse(content); var forecastNodes = xelement.Element("forecast").Element("simpleforecast").Element("forecastdays").Elements(); return(new ForecastResponseDto { Success = true, Items = forecastNodes.Select(ParseNode) }); } catch (Exception ex) { return(new ForecastResponseDto { Success = false, Message = ex.Message }); } }