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))); }
public async Task <JsonResult <List <TodoDto> > > GetTodos() { var todos = await _todosService.FetchMany(); return(Json(TodoListResponse.Build(todos), GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings)); }
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))); }
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)); }
public async Task <IActionResult> GetTodos([FromQuery] int page = 1, [FromQuery] int pageSize = 5) { var todos = await _todosService.FetchMany(TodoShow.All); return(new OkObjectResult(todos)); }