public async Task <IActionResult> Index()
        {
            ListDevicesModel model = new ListDevicesModel();

            model.Devices = await telldusAPIService.GetDevices();

            return(View(model));
        }
Example #2
0
        public override Task <ModelServiceResult <ListDevicesModel> > GetAsync(CancellationToken cancellationToken)
        {
            var model = new ListDevicesModel
            {
            };

            var devices = DataAccessService.GetAll <DataAccess.Entities.Device>()
                          .Select(d => new
            {
                d.Id,
                d.MacAddress
            })
                          .AsEnumerable()
                          .Select(d => new Device
            {
                Id         = d.Id,
                MacAddress = new PhysicalAddress(d.MacAddress)
            })
            ;

            model.Devices.AddRange(devices);

            return(Task.FromResult(new ModelServiceResult <ListDevicesModel>(model)));
        }