Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            //var testData = await test.GetAllSensorsAsync("all", "8e4c46fe-5e1d-4382-b7fc-19541f7bf3b0");
            //var testData2 = await test.GetSensorById("8e4c46fe-5e1d-4382-b7fc-19541f7bf3b0", "f1796a28-642e-401f-8129-fd7465417061");

            IEnumerable <SensorsFromUser> sensors;
            bool isUserLogged = User.Identity.IsAuthenticated;

            if (!isUserLogged)
            {
                sensors = sensorService.GetAllPublicSensors();

                return(View(sensors));
            }

            string username = User.Identity.Name;

            sensors = sensorService.GetSensorsByUsername(username);

            return(View(sensors));
        }