public async Task <IActionResult> ModifySensor(UserSensorModel mySensorModel) { var sensorMinMaxValuesList = new List <double>(await this.userSensorService.GetSensorsTypeMinMaxValues(mySensorModel.Tag)); mySensorModel.SensorTypeMinVal = sensorMinMaxValuesList[0]; mySensorModel.SensorTypeMaxVal = sensorMinMaxValuesList[1]; return(View(mySensorModel)); }
public async Task <JsonResult> UpdateSensor(string apiSensorId) { try { var sensor = await this.userSensorService.UpdateSensorValue(apiSensorId); var viewModel = new UserSensorModel(sensor); return(new JsonResult(viewModel)); } catch (Exception) { return(new JsonResult("Error: Sensor data is incorrect!")); } }
public async Task <IActionResult> ModifySensorPost(UserSensorModel model) { if (!ModelState.IsValid) { this.StatusMessage = "Error: The data is incorrect!"; return(View("_EditStatusMessage", this.StatusMessage)); } try { await this.userSensorService.EditSensor(model.Id, model.IcbSensorId, model.Name, model.Description, model.MinValue, model.MaxValue, model.PollingInterval, model.Latitude, model.Longtitude, model.IsPublic, model.Alarm); } catch (Exception) { this.StatusMessage = "Error: The data is incorrect!"; return(View("_EditStatusMessage", this.StatusMessage)); } this.StatusMessage = "The sensor has been successfully edited!"; return(View("_EditStatusMessage", this.StatusMessage)); }
public IActionResult SensorGraphic(UserSensorModel viewModel) { return(View(viewModel)); }