Exemplo n.º 1
0
        private void CvPreparationStep_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var test = (PreparationStep)e.CurrentSelection.FirstOrDefault();

            this.currentSelectionPreparationStep = test;
            SelectedPreparationStepsItem(test);
        }
Exemplo n.º 2
0
        public async Task <int> AddFull(CreateRecipeDto createDto)
        {
            var recipe = new Recipe
            {
                Name        = createDto.Name,
                Description = createDto.Description
            };

            Repository.Add(recipe);

            await DbContextProvider.SaveChangesAsync();

            // Add ingredients
            foreach (var recipeIngredientDto in createDto.Ingredients)
            {
                var ingredientDto = await _ingredientsService.GetOrCreate(recipeIngredientDto.Name);

                var recipeIngredient = new RecipeIngredient
                {
                    IngredientId = ingredientDto.Id,
                    Amount       = recipeIngredientDto.Amount,
                    Unit         = recipeIngredientDto.Unit
                };

                recipe.RecipeIngredients.Add(recipeIngredient);
            }

            // Add preperation steps
            foreach (var preparationStepDto in createDto.PreparationSteps)
            {
                var preparationStep = new PreparationStep
                {
                    Description = preparationStepDto.Description
                };

                recipe.PreparationSteps.Add(preparationStep);
            }

            return(await DbContextProvider.SaveChangesAsync());
        }
Exemplo n.º 3
0
 private void SelectedPreparationStepsItem(PreparationStep value)
 {
     this.EntryStepNumber.Text = value.stepNumber.ToString();
     this.EntryText.Text       = value.text;
 }