Esempio n. 1
0
        static void Main(string[] args)
        {
            Startup.Run();
            var serviceCollection = Startup.ServiceCollection;
            var userCreateSubject = new UserCreateSubject();

            serviceCollection.AddSingleton(userCreateSubject);
            var serviceProvider = serviceCollection.BuildServiceProvider();
            var view            = new ConsoleView(userCreateSubject);

            Console.WriteLine("=======================================");
            Console.WriteLine("Welcome to sample of clean architecture");
            Console.WriteLine("=======================================");
            Console.WriteLine();
            Console.WriteLine("Enter the name of the new user.");
            Console.WriteLine("username:"******">");
            var username   = Console.ReadLine();
            var controller = serviceProvider.GetService <UserController>();

            controller.CreateUser(username);

            Console.WriteLine("press any key to exit.");
            Console.ReadKey();
        }
Esempio n. 2
0
 public ConsoleView(UserCreateSubject subject)
 {
     subject.UserCreateViewModelUpdated += Update;
 }