Esempio n. 1
0
        public RoadStatusList MapRoadStatusData(TfLRoadCorridors apiData)
        {
            List <RoadStatus> result = new List <RoadStatus>();

            foreach (var apiResponse in apiData.RoadCorridorList)
            {
                var viewModelResponse = new RoadStatus()
                {
                    Name              = apiResponse.DisplayName,
                    Status            = apiResponse.StatusSeverity,
                    StatusDescription = apiResponse.StatusSeverityDescription
                };
                result.Add(viewModelResponse);
            }

            return(new RoadStatusList(result));
        }
Esempio n. 2
0
        public async Task <RoadStatusList> GetRoadStatusData(string roadNames)
        {
            try
            {
                TfLRoadCorridors apiResponse = await _roadData.GetRoadStatusData(roadNames);

                var result = _mapping.MapRoadStatusData(apiResponse);
                return(result);
            }
            catch (TfLApiException ex)
            {
                RoadStatusException frontEndException = new RoadStatusException(ex.ExceptionDetails.Message);
                frontEndException.ExceptionDetails = ex.ExceptionDetails;
                throw frontEndException;
            }
            catch (Exception ex)
            {
                throw new Exception("Something went wrong. Please try again or contact the developer", ex);
            }
        }