예제 #1
0
        public async Task AddDishToOrderAsync(DishOrdersDto dishOrders)
        {
            var origDishOrders = _mapper.Map <DishOrdersDto, DishOrders>(dishOrders);

            var order = await _orderRepository.Get(dishOrders.OrderId);

            var dish = await _dishRepository.Get(dishOrders.DishId);

            order.TotalPrice += dish.Price * dishOrders.PortionNumber;

            await _orderRepository.Update(order);

            await _orderRepository.AddDishToOrderAsync(origDishOrders);
        }