Ejemplo n.º 1
0
        public async Task LoadAsync(OrderDetailsArgs args)
        {
            ViewModelArgs = args ?? OrderDetailsArgs.CreateDefault();

            if (ViewModelArgs.IsNew)
            {
                Item = await OrderService.CreateNewOrderAsync(ViewModelArgs.CustomerID);

                IsEditMode = true;
            }
            else
            {
                try
                {
                    var item = await OrderService.GetOrderAsync(ViewModelArgs.OrderID);

                    Item = item ?? new OrderModel {
                        OrderID = ViewModelArgs.OrderID, IsEmpty = true
                    };
                }
                catch (Exception ex)
                {
                    LogException("Order", "Load", ex);
                }
            }
            NotifyPropertyChanged(nameof(ItemIsNew));
        }
        public async Task LoadAsync(OrderDetailsArgs args)
        {
            await OrderDetails.LoadAsync(args);

            long orderID = args?.OrderID ?? 0;

            if (orderID > 0)
            {
                await OrderItemList.LoadAsync(new OrderItemListArgs { OrderID = args.OrderID });
            }
            else
            {
                await OrderItemList.LoadAsync(new OrderItemListArgs { IsEmpty = true }, silent : true);
            }
        }