Esempio n. 1
0
        public ActionResult Common()
        {
            var viewModel = new SettingsViewModel()
                {
                    IsMaintenance = settingsRepository.IsInMaintenance,
                    AdministrationEmail = settingsRepository.AdministrationEmail
                };

            return View(viewModel);
        }
Esempio n. 2
0
        public ActionResult Common(SettingsViewModel settings)
        {
            if(ModelState.IsValid)
            {
                using (new UnitOfWork(_currentContext))
                {
                    settingsRepository.AdministrationEmail = settings.AdministrationEmail;
                    settingsRepository.IsInMaintenance = settings.IsMaintenance;
                }

                TempData[Const.ActionResultInfo] = "Настройки изменены";
                return RedirectToAction("Common");
            }

            TempData[Const.ActionResultInfo] = "Ошибка изменения настроек. Проверьте корректность введнных данных";
            return View();
        }