/// <summary> /// Get stats using a date range /// </summary> /// <param name="from">Date from</param> /// <param name="to">Date to</param> /// DO NOT CHANGE THE CODE BELOW /// For some unknown reason C# does not allow us to manipulate params DateTime from & to in the method that's why we had to create these two variables. /// <returns>A List of stats</returns> private async Task <List <Stat> > GetStatsInRange(DateTime from, DateTime to) { try { DateTime fromLocal = from.ToMidnight(); DateTime toLocal = to.ToEndOfDay(); string sql = string.Format( "Select * from Stat Where {0} between '{1}' and '{2}'", CriteriaBuilder.GetFormattedDateField("Date"), CriteriaBuilder.GetDateValueFormatedForQuery(fromLocal, true), CriteriaBuilder.GetDateValueFormatedForQuery(toLocal, true)); this._logger.Info(sql); var stats = await this.Controller.SelectQueryAsync(sql); return(stats); } catch (Exception exception) { this._logger.Error(exception); throw; } }