public ActionResult Index() { ViewBag.Title = "Home Page"; string outputApplication = WebConfigurationManager.AppSettings["OutputApplication"]; Output output = new Output(); OutputService service; switch (outputApplication) { case "CONSOLE": service = new OutputService(new ConsoleOutput()); break; case "DATABASE": service = new OutputService(new DatabaseOutput()); break; default: { service = new OutputService(new ScreenOutput()); break; } } service.ProcessOutput(output); ViewBag.Output = output; return(View()); }