public async Task <ActionResult> RenderChart(int sensorId) { var sensor = await DBService.GetSpecificSensorDisplayDataAsync(sensorId); if (!sensor.IsPublic) { if (GetLoggedUsername() != sensor.UserName) { if (!DBService.BeingSharedWith(sensorId, GetLoggedUsername())) { throw new HttpException(403, "Access denied"); } } } var model = DBService.GetSensorHistory(sensor); return(this.View("Charts/Chart", model)); }