public ProductsController( IProductsStore productsStore, IAuthorizationService authorizationService) { _store = productsStore; _authz = authorizationService; }
public ProductsModule(IProductsStore productsStore) : base("/products") { Get("", _ => { var productsString = Request.Query.productIds; var productIds = ParseProductIdsString(productsString); IEnumerable <Product> products = productsStore.GetProductsByIds(productIds); //todo: how to add e-tag? return(Negotiate .WithHeader("cache-control", "private; max-age: 3600") .WithModel(products)); }); }
public OrderItemType(IDataLoaderContextAccessor accessor, IProductsStore products) { Name = "OrderItem"; Field(x => x.OrderItemId); Field(x => x.Quantity); Field(x => x.UnitPrice); Field <ProductType, Product>() .Name("Product") .ResolveAsync(ctx => { var loader = accessor.Context.GetOrAddBatchLoader <int, Product>("GetProductById", products.GetProductsByIdAsync); return(loader.LoadAsync(ctx.Source.ProductId)); }); }
public ProductsService(IProductsStore productStore) { _productStore = productStore; }
public ProductController(IProductsStore productsStore) { _productsStore = productsStore; }