Exemplo n.º 1
0
        private void OnIngredientDeleted(DeleteMessage <IngredientWrapper> message)
        {
            var ingredient = IngredientDetailViewModels.SingleOrDefault(i => i.Model.Id == message.Id);

            if (ingredient != null)
            {
                IngredientDetailViewModels.Remove(ingredient);
            }
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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;
            }
        }