示例#1
0
 public MainViewModel(IServiceProvider provider,
                      IMealRepository mealRepository,
                      IIngredientBaseRepository ingredientBaseRepository,
                      IIngredientRepository ingredientRepository,
                      IMealService mealService,
                      ITransferService importExportService)
 {
     this.provider = provider;
     this.ingredientBaseRepository = ingredientBaseRepository;
     this.ingredientRepository     = ingredientRepository;
     this.mealRepository           = mealRepository;
     this.mealService         = mealService;
     this.importExportService = importExportService;
     Meals          = new ObservableCollection <Meal>(mealRepository.Find(x => true).GetAwaiter().GetResult());
     IngredientBase = new ObservableCollection <IngredientBase>(GetIngredients());
     CalcTotalNutritionFact();
 }
 public IngredientViewModel(IIngredientBaseRepository ingredientRepository, IIngredientService ingredientService)
 {
     _ingredientRepository = ingredientRepository;
     _ingredientService    = ingredientService;
     Ingredients           = new ObservableCollection <IngredientBase>(ingredientRepository.Find(x => !(x is Ingredient)).GetAwaiter().GetResult());
 }