Пример #1
0
        private void UpdatePlexSettings()
        {
#if !DEBUG
            var s = PlexSettings.GetSettings();
            if (!string.IsNullOrEmpty(s.Ip))
            {
                s.Enable = true;
                PlexSettings.SaveSettings(s);
            }
#endif
        }
        private Response PostPlexSettings()
        {
            var newSettings = JsonConvert.DeserializeObject <PlexSettings>(Request.Body.AsString());
            var result      = this.Validate(newSettings);

            if (!result.IsValid)
            {
                return(ReturnValidationReponse(result));
            }

            var model    = new ApiModel <bool>();
            var settings = PlexSettings.SaveSettings(newSettings);

            if (settings)
            {
                model.Data = true;
                return(ReturnReponse(model));
            }

            model.Error        = true;
            model.ErrorMessage = "Could not update the settings";
            return(ReturnReponse(model));
        }