Пример #1
0
        public async Task <Order> AddProductToOrderAsync(string productId, string accountId)
        {
            Product product = await productRepository.SelectByIdAsync(productId);

            Order order = await orderRepository.SelectProvisionalOrderByAccountIdAsync(accountId);

            order.AddProduct(product, 1);
            await orderRepository.UpdateAsync(order);

            return(order);
        }
Пример #2
0
        public async Task <IActionResult> GetByIdAsync(string id)
        {
            var item = await productRepository.SelectByIdAsync(id);

            if (item == null)
            {
                return(NotFound());
            }
            return(Ok(item));
        }