public ActionResult <StockLevel> Add(
            int productId,
            [FromBody] AddStocksCommand command,
            [FromServices] AddStocks useCase
            )
        {
            var product    = useCase.Handle(productId, command.Amount);
            var stockLevel = new StockLevel(product.QuantityInStock);

            return(Ok(stockLevel));
        }
Example #2
0
        public ActionResult <StockLevel> Add(
            int productId,
            [FromBody] AddStocksCommand command,
            [FromServices] AddStocks useCase
            )
        {
            var product    = useCase.Handle(productId, command.Amount);
            var stockLevel = _mappingService.Map <Product, StockLevel>(product);

            return(Ok(stockLevel));
        }