public bool DisableAlert(AlertDisablingInformation alertDisablingInformation) { DatabaseAlert dbAlert = _dbQueryService.GetAlertById(alertDisablingInformation.AlertId); DateTime disabledUntilDateTime = DateTime.MaxValue; if (!alertDisablingInformation.DisableForever && alertDisablingInformation.DisabledUntil != null) { disabledUntilDateTime = alertDisablingInformation.DisabledUntil.Value; } else if (!alertDisablingInformation.DisableForever && alertDisablingInformation.DisabledUntil == null) { throw new InvalidDataException("Told to disable alert temporarily but no end date"); } dbAlert.DisabledUntil = disabledUntilDateTime; return(_dbQueryService.PersistExistingAlert(dbAlert)); }
public JsonResult DisableAlert(AlertDisablingInformation alertDisablingInformation) { return(Json(AlertService.DisableAlert(alertDisablingInformation))); }