diff --git a/Manager.Interfaces/DTO/ConfigurationDTO.cs b/Manager.Interfaces/DTO/ConfigurationDTO.cs index 933d7aa..715e1cb 100644 --- a/Manager.Interfaces/DTO/ConfigurationDTO.cs +++ b/Manager.Interfaces/DTO/ConfigurationDTO.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Xml.Linq; namespace Manager.Interfaces.DTO { @@ -24,9 +25,17 @@ namespace Manager.Interfaces.DTO public List sectionIds { get; set; } public string loaderImageId { get; set; } // == ResourceId public string loaderImageUrl { get; set; } // == Image url - public string weatherCity { get; set; } // weatherCity + public string weatherCity { get; set; } // Weather City + public DateTimeOffset? weatherUpdatedDate { get; set; } // Weather date update (to only refresh) + public string weatherResult { get; set; } // Weather result + public bool isWeather + { + get + { + return weatherCity != null && weatherCity.Trim().Length > 0; + } + } public bool isDate { get; set; } - public bool isHour { get; set; } } diff --git a/Manager.Interfaces/Models/Configuration.cs b/Manager.Interfaces/Models/Configuration.cs index 2bdd9a9..b9053bb 100644 --- a/Manager.Interfaces/Models/Configuration.cs +++ b/Manager.Interfaces/Models/Configuration.cs @@ -64,6 +64,12 @@ namespace Manager.Interfaces.Models [BsonElement("WeatherCity")] public string WeatherCity { get; set; } + [BsonElement("WeatherUpdatedDate")] + public DateTimeOffset? WeatherUpdatedDate { get; set; } + + [BsonElement("WeatherResult")] + public string WeatherResult { get; set; } + [BsonElement("IsDate")] public bool IsDate { get; set; } @@ -82,6 +88,8 @@ namespace Manager.Interfaces.Models loaderImageId = LoaderImageId, loaderImageUrl = LoaderImageUrl, weatherCity = WeatherCity, + weatherUpdatedDate = WeatherUpdatedDate, + weatherResult = WeatherResult, dateCreation = DateCreation, primaryColor = PrimaryColor, languages = Languages, diff --git a/Manager.Interfaces/Models/Resource.cs b/Manager.Interfaces/Models/Resource.cs index dd807d8..95e71ba 100644 --- a/Manager.Interfaces/Models/Resource.cs +++ b/Manager.Interfaces/Models/Resource.cs @@ -56,6 +56,7 @@ namespace Manager.Interfaces.Models VideoUrl, Audio, PDF, - JSON + JSON, + JSONUrl } } diff --git a/ManagerService/Controllers/ConfigurationController.cs b/ManagerService/Controllers/ConfigurationController.cs index 02658b1..8b79c54 100644 --- a/ManagerService/Controllers/ConfigurationController.cs +++ b/ManagerService/Controllers/ConfigurationController.cs @@ -167,6 +167,8 @@ namespace ManagerService.Controllers configuration.LoaderImageId = newConfiguration.loaderImageId; configuration.LoaderImageUrl = newConfiguration.loaderImageUrl; configuration.WeatherCity = newConfiguration.weatherCity; + configuration.WeatherUpdatedDate = null; + configuration.WeatherResult = null; configuration.IsDate = newConfiguration.isDate; configuration.IsHour = newConfiguration.isHour; @@ -235,6 +237,11 @@ namespace ManagerService.Controllers configuration.LoaderImageId = updatedConfiguration.loaderImageId; configuration.LoaderImageUrl = updatedConfiguration.loaderImageUrl; configuration.WeatherCity = updatedConfiguration.weatherCity; + if (configuration.WeatherCity != updatedConfiguration.weatherCity) + { + configuration.WeatherUpdatedDate = null; + configuration.WeatherResult = null; + } configuration.IsDate = updatedConfiguration.isDate; configuration.IsHour = updatedConfiguration.isHour;