public ActionResult EditSettingRedactionDelete(RedactionRecord redaction, int id = 0) { redaction.Id = id; _textRedactionService.DeleteRedaction(redaction); _notifier.Information(T("Content Redaction deleted")); return RedirectToAction("Index"); }
private bool PlaceholderIsValid(RedactionRecord redaction) { var currentRedaction = GetRedactions().FirstOrDefault(r => r.Placeholder == redaction.Placeholder); if (currentRedaction == null) { return true; } return currentRedaction.Id == redaction.Id; }
public RedactionOperationStatus UpdateRedaction(RedactionRecord redaction) { if (!PlaceholderIsValid(redaction)) { return RedactionOperationStatus.NotUnique; } _repository.Update(redaction); return RedactionOperationStatus.Updated; }
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"); }
public RedactionOperationStatus DeleteRedaction(RedactionRecord redaction) { _repository.Delete(redaction); return RedactionOperationStatus.Removed; }