Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public JsonResult DisableAlert(AlertDisablingInformation alertDisablingInformation)
 {
     return(Json(AlertService.DisableAlert(alertDisablingInformation)));
 }