public SaveOutcomeModel Save(ViewModel viewModel) { var outcome = ""; var options = new Options(); viewModel.CopyToSettings(options); if (!Validate(options, viewModel)) { outcome = "FailedValidation"; } else { try { OptionsStorage.Save(Plugin.Singleton, options); outcome = "Saved"; } catch (ConflictingUpdateException) { outcome = "ConflictingUpdate"; } options = OptionsStorage.Load(Plugin.Singleton); viewModel.RefreshFromSettings(options); Validate(options, viewModel); } return(new SaveOutcomeModel(outcome, viewModel)); }
public SaveOutcomeModel Save(ViewModel viewModel) { var outcome = ""; var options = new Options(); viewModel.CopyToSettings(options); try { OptionsStorage.Save(options); outcome = "Saved"; } catch (ConflictingUpdateException) { outcome = "ConflictingUpdate"; } options = OptionsStorage.Load(); viewModel.RefreshFromSettings(options); return(new SaveOutcomeModel(outcome, viewModel)); }