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