Ejemplo n.º 1
0
        public async Task <IQueryable <DepartmentQuery> > Handle(GetDepartmentCommand request, CancellationToken cancellationToken)
        {
            #region Persistence

            var contragentsDomain = await _DepartmentRepository.Get(request.GraphFilters);

            var response = contragentsDomain.Select(item =>
                                                    item.ToQueryModel <DepartmentQuery>(_Mapper));

            #endregion

            return(response);
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <Infrastructure.Database.Query.Model.Department> > GetDepartments(
            Dictionary <string, GraphFilter> filters,
            [Service] IServiceProvider serviceProvider,
            CancellationToken cancellationToken)
        {
            var getDepartmentCommand = new GetDepartmentCommand
            {
                GraphFilters = filters
            };

            using (var scope = serviceProvider.CreateScope())
            {
                var mediator = scope.ServiceProvider.GetRequiredService <IMediator>();
                return((await mediator.Send(getDepartmentCommand, cancellationToken)).ToList());
            }
        }