public async Task <IActionResult> GetTask(Guid id, [FromServices] ITaskListQuery query) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ListResponse <TaskResponse> response = await query.RunAsync(id); if (response.Items.Count > 0) { return(Ok(response)); } else { return(NotFound(response)); } }
public async Task <IActionResult> GetTasksList([FromServices] ITaskListQuery query) { ListResponse <TaskResponse> response = await query.RunAsync(); return(Ok(value: response)); }
public async Task <IActionResult> GetTasksListAsync(TaskFilter filter, ListOptions options, [FromServices] ITaskListQuery query) { try { if ((await _authorizationService.AuthorizeAsync(User, new Entities.Task(), Operations.Read)).Succeeded) { var response = await query.RunAsync(filter, options); return(Ok(response)); } return(StatusCode(403, "Вы не можете просматривать задачи!")); } catch (WrongSortPropertyException ex) { return(BadRequest(ex.Message)); } }