public async Task <IActionResult> Get(GetTaskQuery query,
                                              [FromServices] IQueryHandlerAsync <GetTaskQuery, GetTaskQuery.Response> handler)
        {
            var result = await this._dispatcher.QueryAsync(handler, query);

            return(Json(new Json(result.Task)));
        }
Example #2
0
        public async Task <IActionResult> Index(
            [FromServices] IQueryHandlerAsync <InventoryItemsQuery, List <Queries.InventoryItem> > queryHandler)
        {
            var inventoryItems = await queryHandler.HandleAsync(new InventoryItemsQuery());

            return(View(inventoryItems));
        }
Example #3
0
 public DynamicQueryHandler(IQueryHandlerAsync queryHandlerAsync,
                            IEnumerable <IQueryableProvider <TSource> > queryableProviders,
                            IEnumerable <IAlterQueryableService <TSource, TDestination> > alterQueryableServices,
                            IEnumerable <IDynamicQueryInterceptorProvider <TSource, TDestination> > dynamicQueryInterceptorProviders,
                            IServiceProvider serviceProvider) : base(queryHandlerAsync, queryableProviders, alterQueryableServices, dynamicQueryInterceptorProviders, serviceProvider)
 {
 }
 public DoctorsController(
     IQueryHandlerAsync <GetDoctorQuery, DoctorReadModel> getDoctorQueryHandler,
     IQueryHandlerAsync <GetAllDoctorsQuery, IReadOnlyList <AllDoctorsReadModel> > getAllDoctorsQueryHandler
     )
 {
     _getDoctorQueryHandler     = getDoctorQueryHandler;
     _getAllDoctorsQueryHandler = getAllDoctorsQueryHandler;
 }
Example #5
0
 public PatientsController(
     IQueryHandlerAsync <GetPatientQuery, PatientReadModel> getPatientQueryHandler,
     IQueryHandlerAsync <GetAllPatientsQuery, IReadOnlyList <AllPatientsReadModel> > getAllPatientsQueryHandler
     )
 {
     _getPatientQueryHandler     = getPatientQueryHandler;
     _getAllPatientsQueryHandler = getAllPatientsQueryHandler;
 }
Example #6
0
        public async Task <IQueryExecutionResult <T> > Read(
            [FromServices] AcmeContext context,
            [FromServices] IQueryHandlerAsync handler,
            [FromBody] IQueryCriteria criteria)
        {
            IQueryable <T> query  = context.Set <T>();
            var            result = await handler.ExecuteAsync(query, criteria);

            return(result);
        }
        // GET: PurchaseOrders/Create
        public async Task <IActionResult> Create(
            [FromServices] IQueryHandlerAsync <SuppliersQuery, List <Supplier> > suppliersQueryHandler,
            [FromServices] IQueryHandlerAsync <InventoryItemsQuery, List <InventoryItem> > inventoryItemsQueryHandler)
        {
            var suppliers = await suppliersQueryHandler.HandleAsync(new SuppliersQuery());

            var inventoryItems = await inventoryItemsQueryHandler.HandleAsync(new InventoryItemsQuery());

            var vm = new CreateViewModel(suppliers, inventoryItems);

            return(View(vm));
        }
 public DynamicQueryHandlerBase(IQueryHandlerAsync queryHandlerAsync,
                                IEnumerable <IQueryableProvider <TSource> > queryableProviders,
                                IEnumerable <IAlterQueryableService <TSource, TDestination> > alterQueryableServices,
                                IEnumerable <IDynamicQueryInterceptorProvider <TSource, TDestination> > dynamicQueryInterceptorProviders,
                                IServiceProvider serviceProvider)
 {
     this.queryHandlerAsync                = queryHandlerAsync;
     this.queryableProviders               = queryableProviders;
     this.alterQueryableServices           = alterQueryableServices;
     this.dynamicQueryInterceptorProviders = dynamicQueryInterceptorProviders;
     this.serviceProvider = serviceProvider;
 }
        // GET: PurchaseOrders/Details/5
        public async Task <IActionResult> Details(
            PurchaseOrderQuery query,
            [FromServices] IQueryHandlerAsync <PurchaseOrderQuery, PurchaseOrder> queryHandler)
        {
            var purchaseOrder = await queryHandler.HandleAsync(query);

            if (purchaseOrder == null)
            {
                return(NotFound());
            }

            return(View(purchaseOrder));
        }
 public AppointmentsController(
     IIdentifierGenerationService identifierGenerationService,
     ICommandHandlerAsync <ScheduleAppointmentCommand> scheduleAppointmentCommandHandler,
     IQueryHandlerAsync <GetAppointmentQuery, AppointmentReadModel> getAppointmentQueryHandler,
     IQueryHandlerAsync <GetAppointmentsForDoctorQuery, IReadOnlyList <AppointmentReadModel> > getAllAppointmentsForDoctorQueryHandler,
     IQueryHandlerAsync <GetAppointmentsForPatientQuery, IReadOnlyList <AppointmentReadModel> > getAllAppointmentsForPatientQueryHandler)
 {
     _identifierGenerationService              = identifierGenerationService;
     _scheduleAppointmentCommandHandler        = scheduleAppointmentCommandHandler;
     _getAppointmentQueryHandler               = getAppointmentQueryHandler;
     _getAllAppointmentsForDoctorQueryHandler  = getAllAppointmentsForDoctorQueryHandler;
     _getAllAppointmentsForPatientQueryHandler = getAllAppointmentsForPatientQueryHandler;
 }
Example #11
0
        public async Task <IQueryExecutionResult <T> > Get(
            [FromServices] AcmeContext context,
            [FromServices] IQueryHandlerAsync handler,
            [FromServices] IQueryCriteria criteria,
            int?page     = null,
            int?pageSize = null)
        {
            criteria.Page     = page;
            criteria.PageSize = pageSize;
            IQueryable <T> query  = context.Set <T>();
            var            result = await handler.ExecuteAsync(query, criteria);

            return(result);
        }
        public void Setup()
        {
            billQueryHandler = Substitute.For<IQueryHandlerAsync<BillQuery, Bill>>();

            billQueryHandler.Execute(Arg.Any<BillQuery>()).Returns(info => bill);

            bill = new Bill
            {
                Package = new Package { Subscriptions = new List<Subscription>() },
                CallCharges = new CallCharges(),
                Statement = new Statement(),
                SkyStore = new SkyStore()
            };
        }
        public Task <TResponse> RequestAsync <TQuery, TResponse>(TQuery query)
        {
            IQueryHandlerAsync <TQuery, TResponse> handler = null;

            handler = _container.GetService <IQueryHandlerAsync <TQuery, TResponse> >();

            if (handler == null)
            {
                throw new Exception("Unable to find matching async query handler");
            }
            else
            {
                return(handler.HandleAsync(query));
            }
        }
Example #14
0
        public async Task <IActionResult> Create(
            [FromServices] IQueryHandlerAsync <BrandsQuery, List <Queries.Brand> > brandsQueryHandler,
            [FromServices] IQueryHandlerAsync <CategoriesQuery, List <Queries.Category> > categoriesQueryHandler)
        {
            var brands = await brandsQueryHandler.HandleAsync(new BrandsQuery());

            var categories = await categoriesQueryHandler.HandleAsync(new CategoriesQuery());

            var vm = new CreateViewModel()
            {
                Brands = brands, Categories = categories
            };

            return(View(vm));
        }
Example #15
0
        public async Task <IActionResult> Details(
            [FromServices] IQueryHandlerAsync <InventoryItemQuery, Queries.InventoryItem> queryHandler,
            InventoryItemQuery query)
        {
            var inventoryItem = await queryHandler.HandleAsync(query);

            if (inventoryItem == null)
            {
                return(NotFound());
            }

            var vm = mapper.Map <DetailsViewModel>(inventoryItem);

            return(View(vm));
        }
Example #16
0
        public async Task <IActionResult> ValidateName(
            [FromServices] IQueryHandlerAsync <InventoryItemNameExistsQuery, bool> inventoryItemNameExistsQueryHandler,
            InventoryItemNameExistsQuery inventoryItemNameExistsQuery,
            string currentName)
        {
            var exists = false;

            if (inventoryItemNameExistsQuery.Name != currentName)
            {
                exists = await inventoryItemNameExistsQueryHandler.HandleAsync(inventoryItemNameExistsQuery);
            }

            if (exists)
            {
                return(Json($"An inventory item with the name ({inventoryItemNameExistsQuery.Name}) already exists."));
            }
            else
            {
                return(Json(true));
            }
        }
Example #17
0
        public async Task <IActionResult> Edit(
            [FromServices] IQueryHandlerAsync <InventoryItemQuery, Queries.InventoryItem> queryHandler,
            InventoryItemQuery query,
            [FromServices] IQueryHandlerAsync <BrandsQuery, List <Queries.Brand> > brandsQueryHandler,
            [FromServices] IQueryHandlerAsync <CategoriesQuery, List <Queries.Category> > categoriesQueryHandler)
        {
            var inventoryItem = await queryHandler.HandleAsync(query);

            if (inventoryItem == null)
            {
                return(NotFound());
            }

            var brands = await brandsQueryHandler.HandleAsync(new BrandsQuery());

            var categories = await categoriesQueryHandler.HandleAsync(new CategoriesQuery());

            var vm = mapper.Map <EditViewModel>(inventoryItem);

            vm.Brands     = brands;
            vm.Categories = categories;

            return(View(vm));
        }
Example #18
0
 public PhoneController(IQueryHandlerAsync<BillQuery, PhoneViewModel> phoneQuery)
 {
     this.phoneQuery = phoneQuery;
 }
        // GET: PurchaseOrders
        public async Task <IActionResult> Index([FromServices] IQueryHandlerAsync <PurchaseOrdersQuery, List <PurchaseOrder> > queryHandler)
        {
            var vm = await queryHandler.HandleAsync(new PurchaseOrdersQuery());

            return(View(vm));
        }
Example #20
0
 public TestQueryDecorator(IQueryHandlerAsync <TestQuery, string> handler)
 {
     _handler = handler;
 }
Example #21
0
 public OkrController(ILogger <OkrController> logger, IQueryHandlerAsync <GetOkrsForTeamQuery, GetOkrsForTeamReadModel> okrQueryHandler)
 {
     _logger          = logger;
     _okrQueryHandler = okrQueryHandler;
 }
Example #22
0
 public TeamController(IQueryHandlerAsync <GetTeamQuery, GetTeamReadModel> teamQueryHandlerAsync)
 {
     _teamQueryHandlerAsync = teamQueryHandlerAsync;
 }
 public BroadbandController(IQueryHandlerAsync<BillQuery, BroadbandViewModel> queryHandler)
 {
     this.queryHandler = queryHandler;
 }
Example #24
0
 public TeamsController(IQueryHandlerAsync <GetTeamsQuery, GetTeamsReadModel> teamsQueryHandler)
 {
     _teamsQueryHandler = teamsQueryHandler;
 }
Example #25
0
 public async Task <TResponse> QueryAsync <TRequest, TResponse>(IQueryHandlerAsync <TRequest, TResponse> queryHandlerAsync, TRequest message)
 {
     return(await queryHandlerAsync.HandleAsync(message));
 }
Example #26
0
 public HomeController(IQueryHandlerAsync<BillQuery, OverviewViewModel> queryHandler)
 {
     this.queryHandler = queryHandler;
 }
 public AuditQueryLoggingDecorator(IQueryHandlerAsync <TQuery, TResult> handler
                                   , ILogger logger)
 {
     _handler = handler;
     _logger  = logger;
 }
Example #28
0
 public TVController(IQueryHandlerAsync<BillQuery, TVViewModel> queryHandler)
 {
     this.queryHandler = queryHandler;
 }