public async Task <IEnumerable <WeatherValueGrouped> > GetReadingValueHistoryGrouped(WeatherValueType weatherValueType, DateTimeOffset start, DateTimeOffset end, int bucketMinutes) { await using var connection = CreateConnection(); var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueHistoryGrouped.sql"); query = query.Replace("@Value", weatherValueType.ToString()); return(await connection.QueryAsync <WeatherValueGrouped>(query, new { Start = start, End = end, BucketMinutes = bucketMinutes })); }
public async Task <decimal> GetReadingValueSum(WeatherValueType weatherValueType, DateTimeOffset start, DateTimeOffset end) { await using var connection = CreateConnection(); var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueSum.sql"); query = query.Replace("@Value", weatherValueType.ToString()); return(await connection.ExecuteScalarAsync <decimal>(query, new { Start = start, End = end })); }