예제 #1
0
        private void UpdateOrderForAPI(Order order, bool sendsignalr = true)
        {
            OrderDTO orderDTO = _mapper.Map <Order, OrderDTO>(order);

            OrderAPI.UpdateOrder(orderDTO);
            try
            {
                if (sendsignalr && order.ReportBackToClient)
                {
                    OrderAPI.BroadCastMessage($"The status of your order for order number {order.OrderReferenceId} is {order.Status}.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
        async Task <bool> IOrderGrain.SetupOrder(Order order)
        {
            _order = order;

            _logger.LogInformation($"Entering order");
            if (order.ReportBackToClient)
            {
                OrderAPI.BroadCastMessage($"The status of your order for order number {order.OrderReferenceId} is {order.Status}.");
            }
            foreach (var pizza in _order.Pizza)
            {
                var grain = GrainFactory.GetGrain <IPizzaGrain>(pizza.Id);
                // await grain.Subscribe(this);
                await grain.SetupPizza(order.Id, pizza);
            }

            //Write grain to persistent storage
            base.State.Order = order;
            // base.State.PizzasGrains = _pizzaGrains;
            // await WriteStateAsync();

            return(true);
        }