Example #1
0
 public ProductsController(IGetProductsCommand get, ICreateProductCommand create, IEditProductCommand edit, IGetProductCommand getOne)
 {
     _get    = get;
     _create = create;
     _edit   = edit;
     _getOne = getOne;
 }
Example #2
0
 public ProductsController(ICreateProductCommand createProduct, IGetProductsCommand getProducts, IDeleteProductsCommand deleteProducts, IEditProductCommand editProduct)
 {
     _createProduct  = createProduct;
     _getProducts    = getProducts;
     _deleteProducts = deleteProducts;
     _editProduct    = editProduct;
 }
Example #3
0
 public ProductsController(IGetProductsCommand getCommand, IGetProductCommand getOneCommand, IAddProductCommand addProductCommand, IDeleteProductCommand deleteProductCommand, IUpdateProductCommand updateProductCommand)
 {
     _getCommand    = getCommand;
     _getOneCommand = getOneCommand;
     _addCommand    = addProductCommand;
     _deleteCommand = deleteProductCommand;
     _updateCommand = updateProductCommand;
 }
 public ProductController(IGetProductsCommand getProducts, IGetProductInsertData getProductInsertData,
                          ICreateProductCommand createProduct, IGetProductCommand getProduct,
                          IEditProductCommand editProduct)
 {
     _getProducts          = getProducts;
     _getProductInsertData = getProductInsertData;
     _createProduct        = createProduct;
     _getProduct           = getProduct;
     _editProduct          = editProduct;
 }
 public ProductsController(IGetProductCommand getProduct, IGetInsertUpdateProductCommand getInsertUpdateProduct, IGetProductsCommand getProducts, IAddProductCommand addProduct, IEditProductCommand editProduct, IGetCategoriesCommand getCategories, IGetManufacturersCommand getManufacturers, IGetSuppliersCommand getSuppliers, IGetProductsFromJsonCommand getProductsFromJson)
 {
     _getProduct             = getProduct;
     _getInsertUpdateProduct = getInsertUpdateProduct;
     _getProducts            = getProducts;
     _addProduct             = addProduct;
     _editProduct            = editProduct;
     _getCategories          = getCategories;
     _getManufacturers       = getManufacturers;
     _getSuppliers           = getSuppliers;
     _getProductsFromJson    = getProductsFromJson;
 }
Example #6
0
        public ProductsControllerTest()
        {
            var optionsMock = new Mock <IOptions <ResourceServiceOptions> >();

            optionsMock.SetupGet(o => o.Value).Returns(new ResourceServiceOptions());

            var svc = new ResourceService(optionsMock.Object);

            var logger   = Mock.Of <ILogger <GetProductsCommand> >();
            var mapper   = new ProductToProductMapper();
            var userRepo = new ProductRepository(svc);

            getProductsCommand   = new GetProductsCommand(userRepo, mapper, logger);
            _controllerUnderTest = new ProductsController();
        }
 public Task <IActionResult> GetAsync(
     [FromServices] IGetProductsCommand command,
     [FromQuery] string sortOption,
     CancellationToken cancellationToken) => command.ExecuteAsync(sortOption, cancellationToken);
 public Task <IActionResult> Products([FromRoute] string filter, [FromServices] IGetProductsCommand command)
 {
     return(command.ExecuteAsync(filter));
 }