Exemplo n.º 1
0
        public async Task <OrderedGoodDto> AddGoodsToOrdered(int goodId, int amount, int buyerId)
        {
            int     orderId    = GetOrCreateOrderId(buyerId, false);
            decimal totalPrice = await ItemRepository.GetItemPrice(goodId);

            var orderedGood = await OrderedGoodRepository.AddToOrderedGood(goodId, amount, buyerId, orderId, totalPrice);

            await OrderRepository.UpdateOrderPrice(orderId);

            return(orderedGood);
        }
Exemplo n.º 2
0
        public async Task DeleteGoodFromOrder(int goodId, int orderId)
        {
            await OrderedGoodRepository.DeleteGoodFromOrder(orderId, goodId);

            await OrderRepository.UpdateOrderPrice(orderId);
        }
Exemplo n.º 3
0
        public List <OrderedGoodDto> GetAllOrderedGoodsByBuyerId(int buyerId)
        {
            var orderId = GetOrCreateOrderId(buyerId, false);

            return(OrderedGoodRepository.GetAllOrderedGoods(orderId));
        }