Пример #1
0
        public PollCreationDTO CreatePollConsole()
        {
            PollCreationDTO pollCreation = new PollCreationDTO();

            Console.WriteLine("Create your poll:\n Enter name: ");
            pollCreation.Name = Console.ReadLine();
            Console.WriteLine("Description:");
            pollCreation.Description = Console.ReadLine();
            pollCreation.OwnerId     = _userRepository.GetUser(_contextRegistration.GetPassportInfo().Item1,
                                                               _contextRegistration.GetPassportInfo().Item2).Id;
            Console.WriteLine("Enter Date of poll start (dd/MM/YYYY): ");
            pollCreation.LeftDateTime = Convert.ToDateTime(Console.ReadLine());
            Console.WriteLine("Enter Date of poll end (dd/MM/YYYY): ");
            pollCreation.RightDateTime = Convert.ToDateTime(Console.ReadLine());
            Console.WriteLine("Allow multiple selection? (Y/N)");
            string temp_ans = Console.ReadKey().ToString();

            Console.ReadLine();
            if (temp_ans == "Y")
            {
                pollCreation.MultipleSelection = true;
            }
            else
            {
                pollCreation.MultipleSelection = false;
            }
            return(pollCreation);
        }
        public bool RegistrateUser(string Name, string Surname, string Email, string password, string RegionName)
        {
            string PaspCode  = _contextRegistration.GetPassportInfo().Item1;
            int    IndefCode = _contextRegistration.GetPassportInfo().Item2;
            var    user      = _userRepos.GetUser(PaspCode, IndefCode);

            user.Name     = Name;
            user.Surname  = Surname;
            user.Email    = Email;
            user.Password = password;
            user.RegionId = _regionRepos.GetRegiondIdByName(RegionName);
            _userRepos.CreateUser(user);
            return(true);
        }