public async Task <IActionResult> ShowMap(int id)
        {
            try
            {
                var sensor = await _userSensorService.FindAsync(id);

                if (sensor == null)
                {
                    throw new ApplicationException($"Unable to find sensor with ID '{id}'.");
                }

                var model = new SensorMapViewModel(sensor);
                return(PartialView(model));
            }
            catch
            {
                return(View("PageNotFound"));
            }
        }
        public static SensorMapViewModel GetSensorMap(IEnumerable <SensorViewModel> sensors, IEnumerable <SensorType> sensorTypes)
        {
            if (sensors == null || !sensors.Any())
            {
                return(null);
            }
            var sensorInfos = Mapper.Map <IEnumerable <SensorMapInfo> >(sensors);

            CalculateCoordinates(sensorInfos);
            SetDimensions(sensorInfos, sensorTypes);

            var sensorMap = new SensorMapViewModel
            {
                SensorMapInfo     = sensorInfos,
                TotalColumnsCount = sensorInfos.Max(x => x.Column) + 1,
                TotalRowsCount    = sensorInfos.Max(y => y.Row) + 1,
            };

            return(sensorMap);
        }