コード例 #1
0
        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());
            }
        }
コード例 #2
0
        protected override Task <IEnumerable <ListDTO> > InternalExecute(GetListsQuery query)
        {
            var uri = UriFactory.CreateDocumentCollectionUri(db, collection);

            return(Task.FromResult(documentClient.CreateDocumentQuery <ListDTO>(uri).AsEnumerable()));
        }
コード例 #3
0
        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());
        }