Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddDishToOrderAsync([FromBody] DishOrdersDto dishOrders)
        {
            await _orderBl.AddDishToOrderAsync(dishOrders);

            return(Ok());
        }