Ejemplo n.º 1
0
        public HttpResponseMessage GetSettingValue([FromBody] string key)
        {
            var setting = _settingsManager.GetSetting(key);

            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent(JsonConvert.SerializeObject(SettingViewModel.Map(setting)), Encoding.UTF8, "application/json");
            return(response);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage SaveSiteSettings([FromBody] List <SettingViewModel> settings)
        {
            var result = new List <Settings>();

            foreach (var settingViewModel in settings)
            {
                result.Add(_settingsManager.SetValue(SettingViewModel.Map(settingViewModel)));
            }

            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent(JsonConvert.SerializeObject(SettingViewModel.MapList(result)), Encoding.UTF8, "application/json");

            return(response);
        }