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

            if (ViewModelArgs.IsNew)
            {
                Item       = new MachineModel();
                IsEditMode = true;
            }
            else
            {
                try
                {
                    var item = await MachineService.GetMachineAsync(ViewModelArgs.MachineID);

                    Item = item ?? new MachineModel {
                        MachineID = ViewModelArgs.MachineID, IsEmpty = true
                    };
                }
                catch (Exception ex)
                {
                    LogException("Machine", "Load", ex);
                }
            }
        }
Ejemplo n.º 2
0
        private async Task PopulateDetails(MachineModel selected)
        {
            try
            {
                var model = await MachineService.GetMachineAsync(selected.MachineId);

                selected.Merge(model);
            }
            catch (Exception ex)
            {
                LogException("Products", "Load Details", ex);
            }
        }