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); }
public async Task DeleteGoodFromOrder(int goodId, int orderId) { await OrderedGoodRepository.DeleteGoodFromOrder(orderId, goodId); await OrderRepository.UpdateOrderPrice(orderId); }
public List <OrderedGoodDto> GetAllOrderedGoodsByBuyerId(int buyerId) { var orderId = GetOrCreateOrderId(buyerId, false); return(OrderedGoodRepository.GetAllOrderedGoods(orderId)); }