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(); }
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")); }