Пример #1
0
        public async Task ToggleBlockAsync(int lockId, bool targetState)
        {
            var remoteLock = await lockRepository.GetByIdAsync(lockId);

            using var content = new StringContent(
                      JsonSerializer.Serialize(new ToggleBlockBody { TargetState = targetState }),
                      Encoding.UTF8,
                      "application/json");

            var url = Path.Combine(remoteLock.Url, "toggleBlock").Replace(@"\", @"/");

            await httpClient.PostAsync(url, content);
        }
Пример #2
0
        public async Task Unlock(UnlockParams param)
        {
            var remoteLock = await lockRepository.GetByIdAsync(param.LockId);

            await lockHttpService.UnlockAsync(param.LockId);

            await actionLogger.AddActionLogAsync(
                $"Lock \"{remoteLock.Name}\" was unlocked",
                ActionType.LockRemoteUnlock,
                DateTime.Now,
                HttpContext.User.GetId());

            await uow.CommitAsync();
        }