Beispiel #1
0
        public ActionResult Akismet(AkismetViewModel viewModel)
        {
            using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
            {
                var settings = SettingsService.GetSettings(false);
                settings.AkismentKey = viewModel.AkismentKey;
                settings.EnableAkisment = viewModel.EnableAkisment;

                try
                {
                    unitOfWork.Commit();
                    _cacheService.ClearStartsWith(CacheKeys.Settings.Main);

                    // Show a message
                    ShowMessage(new GenericMessageViewModel
                    {
                        Message = "Updated",
                        MessageType = GenericMessages.success
                    });
                }
                catch (Exception ex)
                {
                    LoggingService.Error(ex);
                    unitOfWork.Rollback();
                    // Show a message
                    ShowMessage(new GenericMessageViewModel
                    {
                        Message = "Error, Please check log",
                        MessageType = GenericMessages.danger
                    });
                }

                return View(viewModel);
            }
        }
Beispiel #2
0
 public ActionResult Akismet()
 {
     using (UnitOfWorkManager.NewUnitOfWork())
     {
         var viewModel = new AkismetViewModel
         {
             AkismentKey = _settings.AkismentKey,
             EnableAkisment = _settings.EnableAkisment == true
         };
         return View(viewModel);
     }
 }