public async Task <CalculatedPriceResponse> Get(Guid productId) { return(await QueryBus.Execute <GetCalculatedPriceQuery, CalculatedPriceResponse>(new GetCalculatedPriceQuery { ProductId = productId })); }
public async Task <CategoriesResponse> GetAll() { var categoriesQuery = new CategoriesQuery(); var categoriesResponse = await QueryBus.Execute <CategoriesQuery, CategoriesResponse>(categoriesQuery); return(categoriesResponse); }
public async Task <LocalizationObjectResponse> GetLocalizationObject(CultureInfo culture, string category = null) { return(await QueryBus.Execute <LocalizationObjectQuery, LocalizationObjectResponse>(new LocalizationObjectQuery { Culture = culture, Category = category })); }
public async Task <ProductsWithPricesResponse> GetProducts(int page = 0, int itemsPerPage = 10) { var productsWithPricesQuery = new ProductsWithPricesQuery { ItemsOnPage = itemsPerPage, Page = page }; return(await QueryBus.Execute <ProductsWithPricesQuery, ProductsWithPricesResponse>(productsWithPricesQuery)); }
public async Task <AccessTokenModel> LogIn(string email, string password) { var query = new UserIdByCredentialsQuery { Email = email, Password = _sha512Service.Calculate(password) }; var userIdResponse = await QueryBus.Execute <UserIdByCredentialsQuery, UserIdByCredentialsResponse>(query); var accessToken = await GenerateRefreshAndAccessToken(userIdResponse.UserId); return(accessToken); }
public async Task <AccessTokenModel> RefreshToken(string refreshToken, string accessToken) { var userId = _accessTokenService.GetPayload <AuthPayload>(accessToken).UserId; var refreshTokenResponse = await QueryBus.Execute <UserRefreshTokenQuery, UserRefreshTokenResponse>( new UserRefreshTokenQuery { UserId = userId }); if (refreshToken != refreshTokenResponse.RefreshToken) { //TODO throw new NotImplementedException(); } return(await GenerateRefreshAndAccessToken(userId)); }
public async Task <LoginResponseModel> Login(LoginRequestModel model) { var customerIdByCredentialsQuery = new CustomerIdByCredentialsQuery { Email = model.Email, Password = _sha512Service.Calculate(model.Password) }; var customerIdResponse = await QueryBus.Execute <CustomerIdByCredentialsQuery, CustomerIdResponse>(customerIdByCredentialsQuery); var token = _tokenService.Create(new TokenPayload { CustomerId = customerIdResponse.Id }); return(new LoginResponseModel { Token = token }); }
public override async Task <HttpResponseMessage> ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken) { if (!controllerContext.Request.Headers.TryGetValues("AccessToken", out var allTokens)) { throw new AuthorizationRequiredException(); } var token = allTokens.First(); var payload = _accessTokenService.GetPayload <AuthPayload>(token); var refreshTokenResponse = await QueryBus.Execute <UserRefreshTokenQuery, UserRefreshTokenResponse>( new UserRefreshTokenQuery { UserId = payload.UserId }); _accessTokenService.Verify(token, refreshTokenResponse.RefreshToken); return(await base.ExecuteAsync(controllerContext, cancellationToken)); }
public EmployeeDto GetEmployee(Guid empId) { var query = new GetEmployeeQuery(empId); return(queryBus.Execute <GetEmployeeQuery, EmployeeDto>(query)); }
public async Task <TransactionsQueryResult> GetAll(TransactionsQuery query) { return(await QueryBus.Execute <TransactionsQuery, TransactionsQueryResult>(query)); }
public async Task <LocalizedValuesResponse> GetLocalization([FromUri] LocalizedValuesQuery query) { return(await QueryBus.Execute <LocalizedValuesQuery, LocalizedValuesResponse>(query)); }
public async Task <TaxesResponse> GetTaxes() { return(await QueryBus.Execute <TaxesQuery, TaxesResponse>(new TaxesQuery())); }
public void TestExecuteShouldLogExecutingMessage() { _bus.Execute(_query); _mockLogger.Verify(p => p.LogExecuting(_query), Times.Once()); }
public async Task <CustomPropertiesResponse> GetProperties() { return(await QueryBus.Execute <CustomPropertiesQuery, CustomPropertiesResponse>(new CustomPropertiesQuery())); }
public async Task <CalculatedPriceRangeResponse> Get([FromUri] GetCalculatedPriceRangeQuery query) { return(await QueryBus.Execute <GetCalculatedPriceRangeQuery, CalculatedPriceRangeResponse>(query)); }
public async Task <OrdersQueryResult> GetAll(OrdersQuery query) { return(await QueryBus.Execute <OrdersQuery, OrdersQueryResult>(query)); }
public async Task <BoxingsResponse> GetBoxings() { return(await QueryBus.Execute <BoxingsQuery, BoxingsResponse>(new BoxingsQuery())); }
public async Task <ShippingsResponse> GetShippings() { return(await QueryBus.Execute <ShippingsQuery, ShippingsResponse>(new ShippingsQuery())); }
public async Task <AllPricesResponse> Get() { return(await QueryBus.Execute <GetAllPricesQuery, AllPricesResponse>(new GetAllPricesQuery())); }
public async Task <EnvironmentsResponse> GetEnvironments() { return(await QueryBus.Execute <EnvironmentsQuery, EnvironmentsResponse>(new EnvironmentsQuery())); }
public async Task <AllProductsResponse> Get() { var products = await QueryBus.Execute <GetAllProductsQuery, AllProductsResponse>(new GetAllProductsQuery()); return(products); }
public async Task <ProductsResponse> GetAll(ProductsQuery query) { var productsResponse = await QueryBus.Execute <ProductsQuery, ProductsResponse>(query); return(productsResponse); }