public ActionResult <IEnumerable <CalculatedTax> > Get() { var query = new GetAllCalculatedTaxQuery(); var result = _mediator.Dispatch(query); return(Ok(result)); }
public async Task <IActionResult> Get() { var plans = await mediator.Dispatch <GetAllSubscriptionPlansQuery, List <SubscriptionPlanReadModel> >( new GetAllSubscriptionPlansQuery(), User ); return(Ok(plans)); }
public async Task <IActionResult> GetCustomer() { var sub = await mediator.Dispatch <GetCustomerQuery, CustomerReadModel>( new GetCustomerQuery(), User.GetUserId() ); return(Ok(sub)); }
public async Task <IActionResult> GetServices() { List <ServiceView> services = await mediator.Dispatch <GetServicesQuery, List <ServiceView> >( new GetServicesQuery(), User.GetUserId() ); return(Ok(services)); }
public async Task <IActionResult> GetVehicleCategories() { List <VehicleCategoryView> categories = await mediator.Dispatch <GetVehicleCategoriesQuery, List <VehicleCategoryView> >( new GetVehicleCategoriesQuery(), User.GetUserId() ); return(Ok(categories)); }
public async Task <IActionResult> GetAll([FromQuery] int pageNumber, [FromQuery] int pageSize) { var pads = await mediator.Dispatch <GetAllPadSeriesQuery, PagedCollection <PadSeriesReadModel> >( new GetAllPadSeriesQuery(new PagingOptions(pageNumber, pageSize)), User ); return(Ok(pads)); }
public async Task <IActionResult> Event(Models.QueryMiddlewareModel model, CancellationToken cancellationToken) { SampleEvent @event = new SampleEvent() { EventData = model.Name }; await _mediator.Dispatch(@event, cancellationToken); return(View()); }
public async Task <IActionResult> Get([FromQuery] string range, [FromQuery] DateTime date) { AppointmentRange appointmentRange; if (!Enum.TryParse(range, true, out appointmentRange)) { return(BadRequest("Invalid range specified")); } var appointments = await mediator.Dispatch <GetAppointmentsQuery, List <AppointmentView> >( new GetAppointmentsQuery() { Range = appointmentRange, Date = date }, User.GetUserId() ); return(Ok(appointments)); }
public void BasicTest() { var request = new PreActionHandler.Request { Value = "Hello!" }; var result = _mediator.Dispatch(request); Assert.AreEqual(nameof(PreActionHandler.RequestRequestPreProcessor), result.Value); }
public void BasicTest() { var request = new BasicHandler.Request { Value = "Hello!" }; var result = _mediator.Dispatch(request); Assert.AreEqual(request.Value, result.Value); }
public async Task <IActionResult> Create(ReviewCreateCommand create) { var id = await mediator.Dispatch <ReviewCreateCommand, Guid>( create, User ); var r = await mediator.Dispatch <GetReviewByIdQuery, ReviewReadModel>(new(id)); return(Ok(r)); }
public async Task <Response> Handle(CreateUserCommand request, CancellationToken cancellationToken) { try { var newUser = new User(request.Name, request.Surname, request.Birthday, request.Cpf); var userId = await _userRepository.Create(newUser); await _mediator.Dispatch(newUser.DomainEvents, cancellationToken); var address = new Address(userId, request.StreetName, request.StreetNumber, request.Complement, request.Cep, request.City, request.State, request.AddressName); await _addressRepository.Create(address); await _mediator.Dispatch(address.DomainEvents, cancellationToken); return(Response.Ok(HttpStatusCode.Created, userId)); } catch (Exception ex) { _logger.LogError(ex, "Erro ao cadastrar usuário"); return(Response.Fail(HttpStatusCode.InternalServerError, "Erro ao cadastrar usuário")); } }
public async Task <IActionResult> GetAllPermissions() { List <PermissionReadModel> perms = await mediator.Dispatch <GetAllPermissionsQuery, List <PermissionReadModel> >(User); return(Ok(perms)); }
public async Task <IActionResult> GetClients() { var clients = await mediator.Dispatch <GetClientsQuery, List <ClientView> >(new GetClientsQuery(), User.GetUserId()); return(Ok(clients)); }
public async Task <IActionResult> Get() { return(Ok(_mapper.Map <IEnumerable <ValueDTO> >(await _mediator.Dispatch <ValuesQuery, IEnumerable <ValueModel> >()))); }
public async Task <IActionResult> GetAll() { var brands = await mediator.Dispatch <GetAllBrandsQuery, List <BrandReadModel> >(User); return(Ok(brands)); }
public async Task <IActionResult> GetFilter() { var filter = await mediator.Dispatch <GetPadFilterQuery, PadFilterReadModel>(); return(Ok(filter)); }
/// <summary> /// Dispatch a command or query that has an input, and return value. /// </summary> public async static Task <TOutput> Dispatch <TInput, TOutput>(this IMediator mediator, TInput input, ClaimsPrincipal?user = null) where TInput : class, IAction { return(await mediator.Dispatch <TInput, TOutput>(input, user?.GetUserId())); }
/// <summary> /// Dispatch a command or query that doesn't need any input. /// </summary> public async static Task Dispatch <TInput>(this IMediator mediator, ClaimsPrincipal?user = null) where TInput : class, IAction, new() { await mediator.Dispatch <TInput>(user?.GetUserId()); }
public async Task <IActionResult> GetBusiness() { BusinessView b = await mediator.Dispatch <GetBusinessQuery, BusinessView>(new GetBusinessQuery(), User.GetUserId()); return(Ok(b)); }
public async Task <IActionResult> GetAll() { var roles = await mediator.Dispatch <GetAllRolesQuery, List <RoleReadModel> >(User); return(Ok(roles)); }
public async Task <IActionResult> GetHoursOfOperation() { HoursOfOperationView?hours = await mediator.Dispatch <GetHoursOfOperationQuery, HoursOfOperationView>(new GetHoursOfOperationQuery(), User.GetUserId()); return(Ok(hours)); }
public async Task <IActionResult> GetUser() { var user = await mediator.Dispatch <GetUserByAuth0IdQuery, UserReadModel>(User); return(Ok(user)); }