コード例 #1
0
        public async Task <IActionResult> Get(Guid id)
        {
            var user    = Request.GetCurrentUser();
            var isAdmin = user.IsAdministrator();

            try
            {
                var domainLock = await _lockService.GetLockOfUserByIdAsync(user.Id, id, isAdmin);

                var lockDto = domainLock.ToDto();
                lockDto.State = _deviceBusService.GetLockState(id);

                return(Ok(lockDto));
            }
            catch (Exception e)
            {
                _logger.LogError($"An error occured while getting lock with id: {id} with given exception: {e}");
                return(e.Handle());
            }
        }