コード例 #1
0
        public async Task <bool> ClaimAsync(string userId, string id)
        {
            var device = await deviceRepository.GetAsync(id);

            if (null == device)
            {
                device = await deviceRepository.CreateAsync(id);
            }
            if (device.UserId == userId)
            {
                return(true);
            }
            if (device.UserId != null)
            {
                return(false);
            }
            await deviceRepository.ClaimAsync(id, userId);

            return(true);
        }