コード例 #1
0
        public ActionResult EditSettingRedactionDelete(RedactionRecord redaction, int id = 0)
        {
            redaction.Id = id;
            _textRedactionService.DeleteRedaction(redaction);

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

            return RedirectToAction("Index");
        }
コード例 #2
0
        private bool PlaceholderIsValid(RedactionRecord redaction) {
            var currentRedaction = GetRedactions().FirstOrDefault(r => r.Placeholder == redaction.Placeholder);

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

            return currentRedaction.Id == redaction.Id;
        }
コード例 #3
0
        public RedactionOperationStatus UpdateRedaction(RedactionRecord redaction)
        {
            if (!PlaceholderIsValid(redaction))
            {
                return RedactionOperationStatus.NotUnique;
            }

            _repository.Update(redaction);

            return RedactionOperationStatus.Updated;
        }
コード例 #4
0
        public ActionResult EditContentRedactionPost(RedactionRecord redaction, int id = 0)
        {
            redaction.Id = id;
            var status = _textRedactionService.UpdateRedaction(redaction);

            switch (status)
            {
                case RedactionOperationStatus.Created:
                    _notifier.Information(T("Redaction created"));
                    break;
                case RedactionOperationStatus.Updated:
                    _notifier.Information(T("Redaction updated"));
                    break;
                case RedactionOperationStatus.NotUnique:
                    _notifier.Error(T("Redaction could not be saved because the Placeholder was not unique. Ensure that the placeholder you choose does not already exist for another redaction."));
                    return View(redaction);
            }

            return RedirectToAction("Index");
        }
コード例 #5
0
        public RedactionOperationStatus DeleteRedaction(RedactionRecord redaction)
        {
            _repository.Delete(redaction);

            return RedactionOperationStatus.Removed;
        }