public responseEdit PostRegisterDevice(editDevice values)
        {
            string authenticatedUser = HttpContext.User.FindFirst(ClaimTypes.Name).Value;
            Device device            = _context.Find <Device>(values.ID);

            if (device == null)
            {
                return(new responseEdit {
                    Failed = true, ErrorMessage = "That device does not exist"
                });
            }
            if (device.RegisteredUser != null)
            {
                return(new responseEdit {
                    Failed = true, ErrorMessage = "That device is already registered by another user"
                });
            }
            Console.WriteLine("registering device...");
            device.RegisteredUser  = authenticatedUser;
            device.DeviceName      = values.deviceName;
            device.PlantMonitering = values.plantName;
            _context.SaveChanges();
            return(new responseEdit {
                Failed = false, ErrorMessage = "none"
            });
        }
        public responseEdit PostEditDevice(editDevice values)
        {
            string authenticatedUser = HttpContext.User.FindFirst(ClaimTypes.Name).Value;

            Device device = _context.Find <Device>(values.ID);

            if (device.RegisteredUser == authenticatedUser)
            {
                device.DeviceName      = values.deviceName;
                device.PlantMonitering = values.plantName;
                _context.SaveChanges();
                return(new responseEdit {
                    Failed = false
                });
            }


            return(new responseEdit {
                Failed = true
            });
        }