public string Notifica(int segundos) { Notificacao notificacao = new Notificacao(); using (var command = _db.Database.GetDbConnection().CreateCommand()) { command.CommandText = $"SELECT COUNT(*) as contador FROM Envio WHERE Data >= DATEADD(SECOND, {-segundos}, GETDATE())"; _db.Database.OpenConnection(); using (var result = command.ExecuteReader()) { if (result.Read()) { notificacao.Registros = int.Parse(result["contador"].ToString()); notificacao.TipoAlerta = notificacao.GrauAlerta(); } else { notificacao.TipoAlerta = 0; } } } return(notificacao.EnviarAlerta()); }