public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "lists")] HttpRequest req, ILogger log) { try { var query = new GetListsQuery(); var handler = Container.GetInstance <IQueryHandler <GetListsQuery, IEnumerable <ListDTO> > >(); var result = await handler.Execute(query); return(new OkObjectResult(result)); } catch (Exception ex) { Container.GetInstance <TelemetryClient>().TrackException(ex); return(new InternalServerErrorResult()); } }
protected override Task <IEnumerable <ListDTO> > InternalExecute(GetListsQuery query) { var uri = UriFactory.CreateDocumentCollectionUri(db, collection); return(Task.FromResult(documentClient.CreateDocumentQuery <ListDTO>(uri).AsEnumerable())); }
private async Task <ICollection <List> > HandleAsync(GetListsQuery query) { var lists = await this.context.Lists.Include(l => l.Items).ThenInclude(i => i.IteamLabels).ThenInclude(il => il.Label).AsNoTracking().ToListAsync(); return(lists.Select(this.mapper.Map <DataAccess.Model.List, List>).ToList()); }