//do zapisywania
        public void Save(MeasurementRaw measurementRaw)
        {
            var measurement     = CreateMeasurement(measurementRaw);
            var lastMeasurement = GetLastMeasurement(measurement.StationId);

            if (ShouldSaveMeasurement(measurement, lastMeasurement))
            {
                AddMeasurementToDatabase(measurement);
            }
        }
        //do zapisywania
        private Measurement CreateMeasurement(MeasurementRaw measurementRaw)
        {
            var measurement = new Measurement();

            measurement.StationId   = measurementRaw.StationId;
            measurement.StationName = measurementRaw.StationName;
            measurement.AqIndex     = measurementRaw.AqIndex;
            measurement.Values      = measurementRaw.Values;
            measurement.Date        = DateTime.Now;
            return(measurement);
        }
Exemple #3
0
        public void Save([FromBody] MeasurementRaw measurementRaw)
        {
            var measurementsService = new MeasurementsService();

            measurementsService.Save(measurementRaw);
        }