示例#1
0
        private async void OpenEditFoodDialogAsync(Food food)
        {
            var foodClone = food.Clone();

            var dialog = _dialogs.For <FoodDialogViewModel>(DialogsIdentifier);

            dialog.Data.Food              = FoodViewModel.FromModel(foodClone);
            dialog.Data.DialogTitle       = "Modified food";
            dialog.Data.SubmitButtonTitle = "Save";

            var dialogResult = await dialog.Show();

            if (dialogResult != DialogResult.Ok)
            {
                return;
            }

            foodClone = dialog.Data.Food.ToModel();
            Foods.Replace(food, foodClone);

            _foodService.Update(foodClone, food);
        }