コード例 #1
0
 void OnAddingDish(object sender, DishEventArgs args)
 {
     try
     {
         _model.AddDish(args.dish);
     }
     catch (Exception)
     {
         throw new FormatException("Couldn't add dish");
     }
 }
コード例 #2
0
        public void AddingDish(EditMenu edit)
        {
            Dish dish = new Dish(5, "Test", 12, 33.1);
            Dictionary <Ingredient, double> recipy = new Dictionary <Ingredient, double>();

            recipy.Add(edit.GetIngredients().Find(q => q.Id == 6), 33.1);
            dish.ingridients = recipy;
            edit.AddDish(dish);
            IMenu menu = edit.GetMenu(DateTime.Now);

            menu.Dishes.ForEach(d => Console.WriteLine(d));
            edit.RemoveDish(dish);
            menu = edit.GetMenu(DateTime.Now);
            menu.Dishes.ForEach(d => Console.WriteLine(d));
        }
コード例 #3
0
 public bool AddDish(Dish dish)
 {
     return(_model.AddDish(ParseNewDish(dish)));
 }