Ejemplo n.º 1
0
        public async Task <IActionResult> GetOkrsForTeam(Guid teamId)
        {
            _logger.LogDebug($"Handling GET request for teamId {teamId}");
            var results = await _okrQueryHandler.HandleAsync(new GetOkrsForTeamQuery(teamId));

            return(Ok(results));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(
            [FromServices] IQueryHandlerAsync <InventoryItemsQuery, List <Queries.InventoryItem> > queryHandler)
        {
            var inventoryItems = await queryHandler.HandleAsync(new InventoryItemsQuery());

            return(View(inventoryItems));
        }
        public async Task <ActionResult <AllDoctorsReadModel> > GetAll()
        {
            var query = new GetAllDoctorsQuery();
            var allDoctorsReadModel = await _getAllDoctorsQueryHandler.HandleAsync(query);

            return(Ok(allDoctorsReadModel));
        }
        public async Task <ActionResult <DoctorReadModel> > GetById(Guid doctorId)
        {
            var query           = new GetDoctorQuery(doctorId);
            var doctorReadModel = await _getDoctorQueryHandler.HandleAsync(query);

            return(Ok(doctorReadModel));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult <PatientReadModel> > GetById(Guid patientId)
        {
            var query           = new GetPatientQuery(patientId);
            var doctorReadModel = await _getPatientQueryHandler.HandleAsync(query);

            return(Ok(doctorReadModel));
        }
        public async Task <ActionResult <IReadOnlyList <AppointmentReadModel> > > GetAllForPatient(Guid patientId)
        {
            var query = new GetAppointmentsForPatientQuery(patientId);
            var appointmentReadModels = await _getAllAppointmentsForPatientQueryHandler.HandleAsync(query);

            return(Ok(appointmentReadModels));
        }
Ejemplo n.º 7
0
        public Task <TResult> HandleAsync(TQuery query)
        {
            var serializedQuery = JsonConvert.SerializeObject(query);

            _logger.Information("Query of type {FullName}: {serializedQuery}"
                                , query.GetType().FullName, serializedQuery);
            return(_handler.HandleAsync(query));
        }
        public async Task <ActionResult <AppointmentReadModel> > GetById(Guid appointmentId)
        {
            var query = new GetAppointmentQuery(appointmentId);

            var appointmentReadModel = await _getAppointmentQueryHandler.HandleAsync(query);

            return(Ok(appointmentReadModel));
        }
        // 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));
        }
        // 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));
        }
Ejemplo n.º 11
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));
        }
Ejemplo n.º 12
0
        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));
            }
        }
Ejemplo n.º 13
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));
        }
Ejemplo n.º 14
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));
            }
        }
Ejemplo n.º 15
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));
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> GetTeams()
        {
            var results = await _teamsQueryHandler.HandleAsync(new GetTeamsQuery());

            return(Ok(results));
        }
        // GET: PurchaseOrders
        public async Task <IActionResult> Index([FromServices] IQueryHandlerAsync <PurchaseOrdersQuery, List <PurchaseOrder> > queryHandler)
        {
            var vm = await queryHandler.HandleAsync(new PurchaseOrdersQuery());

            return(View(vm));
        }
Ejemplo n.º 18
0
        public async Task <IActionResult> GetTeam(Guid teamId)
        {
            var result = await _teamQueryHandlerAsync.HandleAsync(new GetTeamQuery(teamId));

            return(Ok(result));
        }
Ejemplo n.º 19
0
 public async Task <TResponse> QueryAsync <TRequest, TResponse>(IQueryHandlerAsync <TRequest, TResponse> queryHandlerAsync, TRequest message)
 {
     return(await queryHandlerAsync.HandleAsync(message));
 }
Ejemplo n.º 20
0
 public Task <string> HandleAsync(TestQuery query)
 {
     return(_handler.HandleAsync(new TestQuery(query.Result + " - Decorated")));
 }