public async Task <IActionResult> GetTaskAsync(int taskId, [FromServices] ITaskQuery query)
        {
            if ((await _authorizationService.AuthorizeAsync(User, new Entities.Task(), Operations.Read)).Succeeded)
            {
                TaskResponse response = await query.RunAsync(taskId);

                return(response == null
                    ? (IActionResult)NotFound("Task Not Found")
                    : Ok(response));
            }
            return(StatusCode(403, "Вы не можете просматривать задачи!"));
        }
예제 #2
0
        public async Task <IActionResult> GetTaskAsync(int taskId, [FromServices] ITaskQuery query)
        {
            try
            {
                TaskResponse response = await query.RunAsync(taskId);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
            //return response == null
            //    ? (IActionResult)NotFound()
            //    : Ok(response);
        }