public ActionResult Settings() { var model = new DropboxSettingsViewModel(); var path = Service.UserSettings.GetByUserKey("DropboxPath", GetCurrentUserGuid()); if (path != null) { model.FilePath = path.SettingValue; } var name = Service.UserSettings.GetByUserKey("DropboxFile", GetCurrentUserGuid()); if (name != null) { model.FileName = name.SettingValue; } return View(model); }
public ActionResult Settings(DropboxSettingsViewModel model) { if (!model.FilePath.IsNull()) { if (!model.FilePath.StartsWith("/")) { model.FilePath = "/" + model.FilePath; } Service.UserSettings.SaveSetting("DropboxPath", model.FilePath, GetCurrentUserGuid()); } if (!model.FileName.IsNull()) { if (!model.FileName.EndsWith(".xlsm")) { model.FileName = model.FileName = ".xlsm"; } Service.UserSettings.SaveSetting("DropboxFile", model.FileName, GetCurrentUserGuid()); } return PartialView("SettingsPartial", model); }