Ejemplo n.º 1
0
        public async Task <IActionResult> IndexPostAsync()
        {
            if (_state.semaphore.IsLock())
            {
                return(StatusCode(400, "Post Waiting"));
            }
            var result = new Requests.Response.Base {
                Name = "Post"
            };

            using (_state.semaphore.Lock())
            {
                result.DeviceCode = await _device.HeavyWaitAsync();
            }
            return(StatusCode(200, result));
        }
Ejemplo n.º 2
0
        public IActionResult IndexGet()
        {
            if (_state.semaphore.IsLock())
            {
                return(StatusCode(400, "Get Waiting"));
            }
            var result = new Requests.Response.Base {
                Name = "Get"
            };

            using (_state.semaphore.Lock())
            {
                result.DeviceCode = _device.HeavyWait();
            }
            return(StatusCode(200, result));
        }