Exemple #1
0
        public BrewingControl(Models.Recipe recipe)
        {
            InitializeComponent();
            BrewingViewModel dataContext = new BrewingViewModel(recipe);

            DataContext = dataContext;
        }
Exemple #2
0
        public BrewingControl()
        {
            InitializeComponent();
            BrewingViewModel dataContext = new BrewingViewModel();

            DataContext = dataContext;
        }
Exemple #3
0
        public BrewingViewModel PrepareForBrewing(int id, List <int> brewers)
        {
            var recipe   = context.Recipes.Single(t => t.Id == id);
            var drinkers = context.Brewers.Where(t => brewers.Contains(t.Id));
            var model    = new BrewingViewModel();

            model.Recipe        = new RecipeViewModel(recipe);
            model.AmberRequired = drinkers.Where(t => t.FavouriteBeerType == BeerType.Amber).Sum(t => t.Upkeep);
            model.LagerRequired = drinkers.Where(t => t.FavouriteBeerType == BeerType.Lager).Sum(t => t.Upkeep);
            model.WeissRequired = drinkers.Where(t => t.FavouriteBeerType == BeerType.Wiess).Sum(t => t.Upkeep);
            return(model);
        }