private RoadCondition Map(RoadConditionFileRow fileRow) { var travelRestrictions = MapTravelRestrictions(fileRow); double? temperature = null; if(!string.IsNullOrWhiteSpace(fileRow.Temperature)) temperature = double.Parse(fileRow.Temperature); return new RoadCondition { Start = DateTime.Parse(fileRow.DateUpdated), End = DateTime.Today, RoadConditionText = fileRow.RoadCondition, Temperature = temperature, Weather = fileRow.Weather, TravelRestrictions = travelRestrictions }; }
private List<TravelRestriction> MapTravelRestrictions(RoadConditionFileRow fileRow) { var travelRestrictions = new List<TravelRestriction>(); var eastboundRestriction = MapTravelRestriction(fileRow.RestrictionText1, Direction.Eastbound); var westboundRestriction = MapTravelRestriction(fileRow.RestrictionText2, Direction.Westbound); travelRestrictions.Add(eastboundRestriction); travelRestrictions.Add(westboundRestriction); return travelRestrictions; }