コード例 #1
0
        public void Work()
        {
            var firstCase = new DefaultBirdNotifier();

            firstCase.Notify();

            INotifier secondCase = new SMSNotifier(firstCase);

            secondCase = new EmailNotifier(secondCase);
            secondCase = new SlackNotifier(secondCase);
            secondCase = new VKNotifier(secondCase);
            secondCase.Notify();
        }
コード例 #2
0
        public ActionResult ChangePassword(string notificationtype)
        {
            INotifier notifier = null;

            switch (notificationtype)
            {
            case "email":
                notifier = new EmailNotifier();
                break;

            case "sms":
                notifier = new SMSNotifier();
                break;

            case "popup":
                notifier = new PopupNotifier();
                break;
            }
            UserManager mgr = new UserManager(notifier);

            mgr.ChangePassword("user1", "oldpwd", "newpwd");
            return(View("Success"));
        }