예제 #1
0
파일: Program.cs 프로젝트: GLewKK/TempTMPS
        public override void ApplySausage(SausageDecorator decorator, Sausage sausage)
        {
            if (decorator is AddSausage)
            {
                var validator           = new SausageValidator();
                var vegetablesValidator = new VegetablesValidator();

                var command = new SetNextCommand(vegetablesValidator);
                command.Execute(validator);

                if (validator.IsValid(pizza.SausageTypeList.Sausages) != null)
                {
                    if (validator.IsValid(pizza.SausageTypeList.Sausages).Value)
                    {
                        pizza.SausageTypeList.Sausages.Add(sausage);
                        SausageDecorator sausageDecorator = new AddSausage(sausage);
                        pizza.SausageTypeList.TotalCost = sausageDecorator.GetCost();
                    }
                    else
                    {
                        Console.WriteLine("Value is not valid");
                    }
                }
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: GLewKK/TempTMPS
 public abstract void ApplySausage(SausageDecorator decorator, Sausage sausage);