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; }
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; } }