コード例 #1
0
        public async Task <IActionResult> GetTodos([FromQuery] int page = 1, [FromQuery] int pageSize = 5)
        {
            var result = await _todosService.FetchMany(page, pageSize);

            return(StatusCodeAndDtoWrapper.BuildSuccess(TodoListResponse.Build(result.Item2, Request.Path, page,
                                                                               pageSize, result.Item1)));
        }
コード例 #2
0
        public async Task <JsonResult <List <TodoDto> > > GetTodos()
        {
            var todos = await _todosService.FetchMany();

            return(Json(TodoListResponse.Build(todos),
                        GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings));
        }
コード例 #3
0
        public async Task <HttpResponseMessage> GetTodos([FromUri] int page = 1, [FromUri] int pageSize = 5)
        {
            var result = await _todosService.FetchMany(page, pageSize);

            return(StatusCodeAndDtoWrapper.BuildSuccess(TodoListResponse.Build(result.Item2,
                                                                               Request.RequestUri.LocalPath, page,
                                                                               pageSize, result.Item1)));
        }
コード例 #4
0
        public async Task <Tuple <int, List <Todo> > > Handle(GetTodosCommand request, CancellationToken cancellationToken)
        {
            TodoShow which;

            if (request.Completed != null && request.Completed.Value)
            {
                which = TodoShow.Completed;
            }
            else if (request.Completed != null && !request.Completed.Value)
            {
                which = TodoShow.Pending;
            }
            else
            {
                which = TodoShow.All;
            }

            return(await _todoService.FetchMany(request.Page, request.PageSize, which));
        }
コード例 #5
0
        public async Task <IActionResult> GetTodos([FromQuery] int page = 1, [FromQuery] int pageSize = 5)
        {
            var todos = await _todosService.FetchMany(TodoShow.All);

            return(new OkObjectResult(todos));
        }