Created
January 20, 2014 21:17
-
-
Save AdamCaviness/8529395 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var existingSetting = _settings.Where(s => s.SettingKey == setting.SettingKey).FirstOrDefault(); | |
if (existingSetting == null) | |
throw new ArgumentException("Attempting to update Setting with name '{0}' but the setting is not cached and cannot be updated."); | |
existingSetting.Value = setting.Value; | |
var parameters = new UriOperationParameter[] { | |
new UriOperationParameter("userId", _userSession.User.UserID ), | |
new UriOperationParameter("serializedSetting", _serializationService.SerializeAsString<Setting>(existingSetting)) }; | |
var context = _dataContextFactory.Create(MergeOption.AppendOnly); | |
// Perform WCF Data Services ServiceOperation call. | |
context.Execute<string>(new Uri("UpdateSetting", UriKind.Relative), "POST", true, parameters); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment