protected List<CurrentTimeDto> TransformResults(CurrentTimeResult remoteHostCurrentTimes, CurrentWeatherDto weatherResult) { var results = new List<CurrentTimeDto>(); var dateTimeRawUtc = remoteHostCurrentTimes.DateTimeResult.DateTimeRawUtc; var time = remoteHostCurrentTimes.DateTimeResult.Time; foreach (var currentTime in remoteHostCurrentTimes.CurrentTimes) { var currentTimeDto = new CurrentTimeDto { RideName = currentTime.Name, IsOpened = currentTime.WaitTime.IsOpened(), WaitTime = currentTime.WaitTime.TimeInMinutes(), FastPassTime = currentTime.FastPass, DateTime = new DateTimeDto(dateTimeRawUtc, time), Weather = weatherResult, ParkId = remoteHostCurrentTimes.ParkId, ParkName = remoteHostCurrentTimes.ParkName }; results.Add(currentTimeDto); } return results; }
public Task Save(CurrentTimeResult currentTimeResult) { var finalFolderPath = string.Format(RootFolderPath, currentTimeResult.ParkName); var fileName = CreateFileName(currentTimeResult.ParkName); var fullPath = Path.Combine(finalFolderPath, fileName); if (!Directory.Exists(finalFolderPath)) { Directory.CreateDirectory(finalFolderPath); } var currentTimesJson = JsonConvert.SerializeObject(currentTimeResult); File.WriteAllText(fullPath, currentTimesJson); WriteMessageToConsole(fullPath); return Task.FromResult(0); }