Exemple #1
0
        private void SelectIngredient(Guid id)
        {
            var ingredientDetailViewModel =
                IngredientDetailViewModels.SingleOrDefault(vm => vm.Model.Id == id);

            if (ingredientDetailViewModel == null)
            {
                ingredientDetailViewModel = _ingredientDetailViewModelFactory.Create();
                IngredientDetailViewModels.Add(ingredientDetailViewModel);
                ingredientDetailViewModel.Load(id);
            }

            SelectedIngredientDetailViewModel = ingredientDetailViewModel;
        }
Exemple #2
0
        private void SelectIngredient(Guid?id)
        {
            if (id is null)
            {
                SelectedIngredientDetailViewModel = null;
            }
            else
            {
                var ingredientDetailViewModel =
                    IngredientDetailViewModels.SingleOrDefault(vm => vm.Model?.Id == id);
                if (ingredientDetailViewModel == null)
                {
                    ingredientDetailViewModel = _ingredientDetailViewModelFactory.Create();
                    IngredientDetailViewModels.Add(ingredientDetailViewModel);
                    ingredientDetailViewModel.LoadAsync(id.Value);
                }

                SelectedIngredientDetailViewModel = ingredientDetailViewModel;
            }
        }