Пример #1
0
 public static FrontController GetInstance()
 {
     if (instance == null)
     {
         instance = new FrontController();
     }
     return(instance);
 }
Пример #2
0
        static void Main(string[] args)
        {
            FrontController controller = FrontController.GetInstance();

            // Rotas
            controller.AddRoute("", new HomeView());
            controller.AddRoute("about", new AboutView());
            controller.AddRoute("contact", new ContactView());

            HandleRequests();
        }
Пример #3
0
        static void HandleRequests()
        {
            FrontController controller = FrontController.GetInstance();

            while (true)
            {
                Console.Write("Enter desired route: ");
                var route = Console.ReadLine();
                controller.DispatchRoute(route);
                Console.WriteLine();
            }
        }