Beispiel #1
0
        static void Main(string[] args)
        {
            User x;
            var user = new User("Rafael", "*****@*****.**");
            user.SetPassword("teste123!@", "teste123!@");
            user.Validate();

            using (IUserRepository repo = new UserRepository(new AppDataContext()))
            {

                repo.Create(user);
            }

            using (IUserRepository repo = new UserRepository(new AppDataContext()))
            {
                x = repo.Get("*****@*****.**");
                Console.WriteLine(x.Name);
            }





            Console.ReadKey();

            //using (IUserRepository repo = new UserRepository(new AppDataContext()))
            //{
            //    repo.Delete(x);
            //}
        }
Beispiel #2
0
        public void Register(string name, string email, string password, string confirmPassword)
        {
            var hasUser = _repository.Get(email);
            if (hasUser != null)
                throw new Exception(Errors.DuplicateEmail);

            var user = new User(name, email);
            user.SetPassword(password, confirmPassword);
            user.Validate();

            _repository.Create(user);
        }