示例#1
0
        //Больше ПРОВЕРОК!!
        private static void AddUser()// сюда бы регулярку прикрутить
        {
            System.Console.Write("Registration!!!!! ");

            System.Console.Write("Enter your's Email: ");
            string email = System.Console.ReadLine();

            System.Console.Write("Actually right now We don't have working convector to password  , and you can register without password )))) ");
            //string password = System.Console.ReadLine();

            System.Console.Write("Enter your's Nickname: ");
            string nickname = System.Console.ReadLine();

            System.Console.Write("Enter your's First Name: ");
            string firstname = System.Console.ReadLine();

            System.Console.Write("Enter your's Last Name: ");
            string lastname = System.Console.ReadLine();

            System.Console.Write("Enter your's date of birth (dd/mm/yyyy): ");
            DateTime dateOfBirth;

            // проверки
            if (string.IsNullOrWhiteSpace(nickname) | !DateTime.TryParse(System.Console.ReadLine(), out dateOfBirth))
            {
                System.Console.WriteLine("Incorrect input");
            }
            else
            {
                try
                {
                    if (usersBLL.AddUser(new UserVM(firstname, lastname, nickname, email, dateOfBirth, 123)))
                    {
                        System.Console.WriteLine("Successfully added");
                    }
                    else
                    {
                        System.Console.WriteLine("Such user already exists");
                    }
                }
                catch (ArgumentException)
                {
                    System.Console.WriteLine("Incorrect date of birth");
                }
            }
            System.Console.ReadLine();
        }