示例#1
0
        public async Task <ActionResult> DeleteDeviceAsync(string id)
        {
            ExtractToken();
            var token = appUserTokensRepository.Get(accessTokenHeader);

            if (token != null)
            {
                var device = await devicesRepository.GetDeviceAsync(id);

                if (token.AppUserId == device.AppUserId)
                {
                    await devicesRepository.DeleteDeviceAsync(id);

                    return(Ok(new {
                        message = "Removed"
                    }));
                }
                return(NotFound());
            }
            return(Unauthorized());
        }