Пример #1
0
 //Метод удаления блюдв
 public void DeleteDish()
 {
     if (SelectedDish != null)
     {
         Sushi.Remove(SelectedDish);
         SelectedDish = null;
     }
 }
Пример #2
0
 //Метод добавления допингов (приминение паттерна "Декоратор")
 public void AddSupplement()
 {
     if (SelectedDish != null)
     {
         if (!string.IsNullOrEmpty(SelectedSupplement))
         {
             if (SelectedSupplement.Equals("Обернуть лососем"))
             {
                 ExtraSalmon salmon = new ExtraSalmon(SelectedDish);
                 Sushi.Remove(SelectedDish);
                 Sushi.Add(salmon);
                 SelectedDish = salmon;
             }
             else if (SelectedSupplement.Equals("Обернуть тунцом"))
             {
                 ExtraTuna tuna = new ExtraTuna(SelectedDish);
                 Sushi.Remove(SelectedDish);
                 Sushi.Add(tuna);
                 SelectedDish = tuna;
             }
             else if (SelectedSupplement.Equals("Посыпать кунжутом"))
             {
                 SprinkleSesame sesame = new SprinkleSesame(SelectedDish);
                 Sushi.Remove(SelectedDish);
                 Sushi.Add(sesame);
                 SelectedDish = sesame;
             }
             else if (SelectedSupplement.Equals("Глазировать"))
             {
                 Glazing glazing = new Glazing(SelectedDish);
                 Sushi.Remove(SelectedDish);
                 Sushi.Add(glazing);
                 SelectedDish = glazing;
             }
         }
     }
 }