Example #1
0
        public async Task <TrackingDeviceDto> Put(string id, [FromBody] TrackingDeviceDto device)
        {
            var model = this.dtoMapper.Map <TrackingDevice>(device);

            var result = await this.deviceService.UpdateAsync(id, model);

            return(this.dtoMapper.Map <TrackingDeviceDto>(result));
        }
Example #2
0
        public async Task <IActionResult> Post([FromBody] TrackingDeviceDto device, [FromQuery] string nonce = null)
        {
            var model = this.dtoMapper.Map <TrackingDevice>(device);

            var response = await this.deviceService.AddOrUpdateDeviceAsync(model);

            await this.deviceAdditionHubContext.Clients.All.InvokeAsync("DeviceAdded", nonce);

            return(Json(await this.tokenService.GetLongLivedDeviceToken(response, false)));
        }