public async Task <IActionResult> DeleteTaskAsync(int taskId, [FromServices] IDeleteTaskCommand command, [FromServices] IGetTaskQuery query)
        {
            var task = await query.RunAsync(taskId);

            if ((await _authorizationService.AuthorizeAsync(User, task, Operations.Delete)).Succeeded)
            {
                await command.ExecuteAsync(taskId);

                return(NoContent());
            }
            return(StatusCode(403, "Вы не можете удалить эту задачу!"));
        }
        public async Task <IActionResult> UpdateTaskAsync(int taskId, [FromBody] UpdateTaskRequest request, [FromServices] IUpdateTaskCommand command, [FromServices] IGetTaskQuery query)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var task = await query.RunAsync(taskId);

            if ((await _authorizationService.AuthorizeAsync(User, task, Operations.Update)).Succeeded)
            {
                TaskResponse response = await command.ExecuteAsync(taskId, request);

                return(response == null
                    ? (IActionResult)NotFound("Task Not Found")
                    : Ok(response));
            }
            return(StatusCode(403, "Вы не можете изменить эту задачу!"));
        }