public DashboardViewModel GetDashboardViewModel()
    {
        var model = factory.CreateDashboardViewModel();
        var url   = urlHelper.Action("GetWaterTemperatureChart", "History")
                    var waterTemp = sensorDataService.GetWaterTemperatureFahrenheit().Value;

        model.Value = waterTemp;
        model.url   = url;
        return(model);
    }
Beispiel #2
0
        public IViewComponentResult Invoke()
        {
            var viewModel = new List <string>();

            if (sensorDataService.GetFishMotionPercentage().Value > thresholdConfig.FishMotionMax)
            {
                viewModel.Add("Too much fish activity");
            }
            if (sensorDataService.GetFishMotionPercentage().Value < thresholdConfig.FishMotionMin)
            {
                viewModel.Add("Looks like we have some dead fish");
            }

            if (sensorDataService.GetLightIntensityLumens().Value > thresholdConfig.LightIntensityMax)
            {
                viewModel.Add("Bright light, bright light!");
            }
            if (sensorDataService.GetLightIntensityLumens().Value < thresholdConfig.LightIntensityMin)
            {
                viewModel.Add("It's dark out here");
            }

            if (sensorDataService.GetWaterOpacityPercentage().Value > thresholdConfig.WaterOpacityMax)
            {
                viewModel.Add("The fish can't see you");
            }
            if (sensorDataService.GetWaterOpacityPercentage().Value < thresholdConfig.WaterOpacityMin)
            {
                viewModel.Add("Water too clean");
            }

            if (sensorDataService.GetWaterTemperatureFahrenheit().Value > thresholdConfig.WaterTemperatureMax)
            {
                viewModel.Add("Water too hot!");
            }
            if (sensorDataService.GetWaterTemperatureFahrenheit().Value < thresholdConfig.WaterTemperatureMin)
            {
                viewModel.Add("Water too cold!");
            }

            return(View(viewModel));
        }
Beispiel #3
0
        public DashboardViewModel GetDashboardViewModel()
        {
            return(new DashboardViewModel
            {
                LastFed = "unknown",

                WaterTemperatureTile = new SensorTileViewModel
                {
                    Title = "Water temperature",
                    Value = sensorDataService.GetWaterTemperatureFahrenheit().Value,
                    ColorCssClass = "panel-primary",
                    IconCssClass = "fa-sliders",
                    Url = urlHelper.Action("GetWaterTemperatureChart", "History")
                },
                FishMotionTile = new SensorTileViewModel
                {
                    Title = "Fish motion",
                    Value = sensorDataService.GetFishMotionPercentage().Value,
                    ColorCssClass = "panel-green",
                    IconCssClass = "fa-car",
                    Url = urlHelper.Action("GetFishMotionPercentageChart", "History")
                },
                WaterOpacityTile = new SensorTileViewModel
                {
                    Title = "Water opacity",
                    Value = sensorDataService.GetWaterOpacityPercentage().Value,
                    ColorCssClass = "panel-yellow",
                    IconCssClass = "fa-adjust",
                    Url = urlHelper.Action("GetWaterOpacityPercentageChart", "History")
                },
                LightIntensityTile = new SensorTileViewModel
                {
                    Title = "Light intensity",
                    Value = sensorDataService.GetLightIntensityLumens().Value,
                    ColorCssClass = "panel-red",
                    IconCssClass = "fa-lightbulb-o",
                    Url = urlHelper.Action("GetLightIntensityLumensChart", "History")
                }
            });
        }