コード例 #1
0
        public void CreateNewUser()
        {
            Console.Clear();
            // create user
            UserViewModel userVM = UserVMInstanceCreator.CreateUser();

            // user data is valid?
            if (this.userService.GetAllUsers().Any(x => x.Email == userVM.Email))
            {
                Console.WriteLine("User with this email already exists!");
                Thread.Sleep(4000);
                ProgramBranch.StartApplication();
            }

            // Create new user, if not - false
            bool createUser = this.userService.CreateUser(Mapping.CreateMapFromVMToDomain <UserViewModel, User>(userVM));

            // Show result
            ProgramConsoleMessageHelper.
            ShowFunctionResult(
                createUser,
                "User successfully created!",
                "Something wrong",
                ProgramBranch.StartApplication,
                ProgramBranch.StartApplication
                );
        }
コード例 #2
0
        public void VerifyLoginAndPassword()
        {
            // get data from user
            string name     = GetDataHelper.GetNameFromUser();
            string password = GetDataHelper.GetPasswordFromUser();

            // verify user
            bool validUser = this.userService.VerifyUser(name, password);

            if (validUser)
            {
                ProgramBranch.SelectFirstStepForAuthorizedUser();
            }
            else
            {
                Console.WriteLine("User with such data does not exist");
                Thread.Sleep(4000);
                ProgramBranch.StartApplication();
            }
        }
コード例 #3
0
        static void Main()
        {
            ProgramBranch.StartApplication();

            Console.ReadLine();
        }