Example #1
0
        public async Task <ActionResult <StockLevel> > AddAsync(
            int productId,
            [FromBody] AddStocks.Command command
            )
        {
            command.ProductId = productId;
            var product = await _mediator.Send(command);

            var stockLevel = new StockLevel(product.QuantityInStock);

            return(Ok(stockLevel));
        }
Example #2
0
        public async Task <ActionResult <StockLevel> > AddAsync(
            int productId,
            [FromBody] AddStocks.Command command,
            CancellationToken cancellationToken
            )
        {
            command.ProductId = productId;
            var quantityInStock = await _mediator.Send(command, cancellationToken);

            var stockLevel = new StockLevel(quantityInStock);

            return(Ok(stockLevel));
        }
Example #3
0
        public async Task <ActionResult <StockLevel> > AddStockAsync(
            int productId,
            [FromBody] AddStocks.Command command,
            CancellationToken cancellationToken
            )
        {
            command.ProductId = productId;
            var product = await _mediator.Send(command, cancellationToken);

            var stockLevel = _mapper.Map <DTO.StockLevel>(product);

            return(Ok(stockLevel));
        }