Exemple #1
0
 public ActionResult Index(RuntimeOptions model)
 {
     if (TryUpdateModel(model)) {
         model.Save();
         return this.RedirectToAction("Index", "Home", new { area = "" });
     }
     ViewBag.Title = "Nastavení systému";
     ViewBag.CancelAction = "Index";
     ViewBag.CancelController = "Home";
     ViewBag.HeaderText = "Pozor! Nesprávné nastavení může způsobit nefunkčnost aplikace. Pokud nevíte, co děláte, neměňte hodnoty na této stránce.";
     return View("~/Views/Shared/UniversalEditor.cshtml", model);
 }
Exemple #2
0
 public void Save(bool setupCompleted = true)
 {
     var jsonFileName = HttpContext.Current.Server.MapPath(FILE_NAME);
     lock (writeLock) {
         currentOptions = this;
         currentOptions.SetupCompleted = setupCompleted;
         currentOptions.DateSaved = DateTime.Now;
         var json = JsonConvert.SerializeObject(currentOptions);
         File.WriteAllText(jsonFileName, json);
     }
 }