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"); } } } }
public abstract void ApplySausage(SausageDecorator decorator, Sausage sausage);