public async Task <List <ListViewDataRow> > GetDesiredDataFromApiForListView(bool isTemperature, bool isHumidity, int amount, string date, string sensorName) { if (isTemperature && isHumidity) { isHumidity = false; } if (isTemperature) { var rowList = CreateNewListForTemperature(); var repo = new TemperatureRepository(); var temperatures = await repo.GetTemperatures(amount, date, sensorName); foreach (var item in temperatures) { rowList.Add(new ListViewDataRow() { RoomName = item.TemperatureSensor.Room.Name.ToString(), SensorName = item.TemperatureSensor.Name.ToString(), Value = item.Value.ToString(), Date = item.Date.ToShortDateString() }); } return(rowList); } else if (isHumidity) { var rowList = CreateNewListForHumidity(); var repo = new HumidityRepository(); var humidity = await repo.GetHumidity(amount, date, sensorName); foreach (var item in humidity) { rowList.Add(new ListViewDataRow() { RoomName = item.HumiditySensor.Room.Name.ToString(), SensorName = item.HumiditySensor.Name.ToString(), Value = item.Value.ToString(), Date = item.Date.ToShortDateString() }); } return(rowList); } else { return(null); } }
public UnitOfWork(ApplicationDbContext db) { _db = db; Room = new RoomRepository(_db); Device = new DeviceRepository(_db); HttpDevice = new HttpDeviceRepository(_db); MqttDevice = new MqttDeviceRepository(_db); ZigbeeDevice = new ZigbeeDeviceRepository(_db); PublishMessage = new MqttPublishingMessageRepository(_db); SubscribeMessage = new MqttSubscriptionMessageRepository(_db); BatteryReading = new BatteryRepository(_db); ContactReading = new ContactRepository(_db); HumidityReading = new HumidityRepository(_db); MotionReading = new MotionRepository(_db); TemperatureReading = new TemperatureRepository(_db); }
public async Task <List <PlotData> > GetHumidityFromApiForPlot(string dateTime, string sensorName) { var humidityList = new List <PlotData>(); var repo = new HumidityRepository(); var humidity = await repo.GetHumidity(100, dateTime, sensorName); foreach (var item in humidity) { humidityList.Add(new PlotData() { Value = item.Value, Date = item.Date }); } return(humidityList); }
public UnitOfWork(GrowingPlantsContext context) { UserRepository = new UserRepository(context); TreeRepository = new TreeRepository(context); MeasurementUnitRepository = new MeasurementUnitRepository(context); LightRepository = new LightRepository(context); HumidityRepository = new HumidityRepository(context); TemperatureRepository = new TemperatureRepository(context); FavoriteTreeRepository = new FavoriteTreeRepository(context); CountryRepository = new CountryRepository(context); PlantingProcessRepository = new PlantingProcessRepository(context); PlantingEnvironmentRepository = new PlantingEnvironmentRepository(context); ProcessStepRepository = new ProcessStepRepository(context); PlantingActionRepository = new PlantingActionRepository(context); RecurrenceRepository = new RecurrenceRepository(context); NotificationRepository = new NotificationRepository(context); PlantingSpotRepository = new PlantingSpotRepository(context); PlantTypeRepository = new PlantTypeRepository(context); GalleryRepository = new GalleryRepository(context); PictureRepository = new PictureRepository(context); }
public HumidityController() { _humidityRepository = new HumidityRepository(); }
public async Task <IEnumerable <HumidityAvgYearly> > GetHumidityAvgYearly(string sensorName) { var repo = new HumidityRepository(); return(await repo.GetHumidityAvgYearly(sensorName)); }