示例#1
0
        public ActionResult EditSettingRedactionDelete(SettingRedactionRecord redaction, int id = 0)
        {
            redaction.Id = id;
            _settingRedactionService.DeleteRedaction(redaction);

            _notifier.Information(T("Setting Redaction deleted"));

            return(RedirectToAction("Index"));
        }
示例#2
0
        private bool RedactionIsValid(SettingRedactionRecord redaction)
        {
            var currentRedaction = GetRedactions().FirstOrDefault(r => r.SettingName == redaction.SettingName);

            if (currentRedaction == null)
            {
                return(true);
            }

            return(currentRedaction.Id == redaction.Id);
        }
示例#3
0
        public RedactionOperationStatus UpdateRedaction(SettingRedactionRecord redaction)
        {
            if (!RedactionIsValid(redaction))
            {
                return(RedactionOperationStatus.NotUnique);
            }

            _repository.Update(redaction);

            return(RedactionOperationStatus.Updated);
        }
示例#4
0
        public ActionResult EditSettingRedactionPost(SettingRedactionRecord redaction, int id = 0)
        {
            redaction.Id = id;
            var status = _settingRedactionService.UpdateRedaction(redaction);

            switch (status)
            {
            case RedactionOperationStatus.Created:
                _notifier.Information(T("Setting Redaction created"));
                break;

            case RedactionOperationStatus.Updated:
                _notifier.Information(T("Setting Redaction updated"));
                break;

            case RedactionOperationStatus.NotUnique:
                _notifier.Error(T("Setting Redaction could not be saved because there is already a Setting Redaction for the setting {0}.", redaction.SettingName));
                return(View(redaction));
            }

            return(RedirectToAction("Index"));
        }
示例#5
0
        public RedactionOperationStatus DeleteRedaction(SettingRedactionRecord redaction)
        {
            _repository.Delete(redaction);

            return(RedactionOperationStatus.Removed);
        }