public double GetAverageEnergy(DateTime startFrom, DateTime endBy) { var resultObservations = _observations.Where(x => x.ObservationTime > startFrom && x.ObservationTime < endBy).ToList(); return(resultObservations.Sum(x => x.EstimatedValue) / resultObservations.Count()); }
public double GetAverageEnergy(DateTime startFrom, DateTime endBy) { return(_energyObservationStorage.Where(e => e.ObservationTime >= startFrom && e.ObservationTime <= endBy) .Average(e => e.EstimatedValue)); }
public double GetAverageEnergy(DateTime startFrom, DateTime endBy) { return(_observationStorage.Where(obs => obs.ObservationTime >= startFrom && endBy >= obs.ObservationTime) .Average(obs => obs.EstimatedValue)); }