Exemplo n.º 1
0
        public async Task <IActionResult> ChangeStatus([FromHeader(Name = "api_key")] string apiKey, int newStatus)
        {
            Worker worker = await workerService.GetByApiKeyAsync(apiKey);

            if (worker == null)
            {
                return(Unauthorized());
            }

            if (await workerService.ChangeStatusAsync(worker, newStatus))
            {
                return(Ok());
            }

            return(BadRequest());
        }