public ActionResult Settings() { var viewModel = new SettingViewModel(); viewModel.SubscriptionId = AMUWHelper.GetAppSetting("Azure-SubscriptionId"); viewModel.Credential = AMUWHelper.GetAppSetting("Azure-Credential"); return View(viewModel); }
public ActionResult Settings(SettingViewModel viewModel) { if (ModelState.IsValid) { Configuration webConfigApp = WebConfigurationManager.OpenWebConfiguration("~"); //Modifying the AppKey from AppValue to SubscriptionId and Credential webConfigApp.AppSettings.Settings["Azure-SubscriptionId"].Value = viewModel.SubscriptionId; webConfigApp.AppSettings.Settings["Azure-Credential"].Value = viewModel.Credential; //Save the Modified settings of AppSettings. webConfigApp.Save(); return RedirectToAction("Index"); } return View(); }