public MainViewModel(IRecipeLogic data, INutritionCalculator nutritionCalculator, IRecipeCategoryLogic categoryLogic,CategoriesViewModel categoriesViewModel )//RecipesListViewModel recipesListViewModel { this.data = data; this.categoryLogic = categoryLogic; this.nutritionCalculator = nutritionCalculator; this.CurrentPageViewModel = categoriesViewModel; }
public ItemViewModel(IRecipeCategoryLogic recipeCategoryLogic, INutritionCalculator data, RecipeDTO recipe) { this.data = data; this.recipeCategoryLogic = recipeCategoryLogic; if (recipe != null) { this.data = data; SelectedRecipe = recipe; NutritionPer100Gramm = data.CalculateNutritionPer100Gram(SelectedRecipe); this.CurrentCategory = recipeCategoryLogic.GetCategoryByRecipeId(SelectedRecipe.Id); var images = SelectedRecipe.Images; this.ImagesViewsCollection = new ObservableCollection <RecipeImageDTO>(images); var instructions = SelectedRecipe.Instruction.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); this.CurrentRecipeInstructions = new ObservableCollection <string>(instructions); } }