Ejemplo n.º 1
0
        private async Task <IReadOnlyCollection <LocationDropdownModel> > LoadLocations()
        {
            var dropdownQuery = new LocationDropdownQuery(User);
            var items         = await Mediator.Send(dropdownQuery);

            return(items);
        }
        protected override async Task <IReadOnlyCollection <LocationDropdownModel> > Process(LocationDropdownQuery request, CancellationToken cancellationToken)
        {
            var tenantId = _userClaimManager.GetRequiredTenantId(request.Principal);

            var result = await DataContext.Locations
                         .AsNoTracking()
                         .Where(q => q.TenantId == tenantId)
                         .OrderBy(q => q.Name)
                         .ProjectTo <LocationDropdownModel>(Mapper.ConfigurationProvider)
                         .ToListAsync(cancellationToken);

            return(result);
        }