Пример #1
0
        private async Task <IEnumerable <TodoItem> > GetRandomTodoItems()
        {
            var rnd        = new Random();
            var httpClient = new HttpClient();
            var client     = new api.clients.TodoApiClient("https://localhost:5005", httpClient);
            var todoItems  = await client.TodoItemsAllAsync();

            return(todoItems.Take(rnd.Next(0, todoItems.Count())));
        }
Пример #2
0
        public async Task <IEnumerable <TodoItemResource> > Get()
        {
            _logger.LogInformation("In front-end");
            var httpClient = new HttpClient();
            var client     = new api.clients.TodoApiClient("https://localhost:5005", httpClient);
            var todoItems  = await client.TodoItemsAllAsync();

            return(todoItems.Select(x => new TodoItemResource
            {
                Id = x.Id,
                IsComplete = x.IsComplete,
                Name = x.Name
            })
                   .ToArray());
        }