예제 #1
0
파일: UserService.cs 프로젝트: rodmjay/Trul
        public UserDTO Register(UserDTO user, string password)
        {
            var entity = GetUserByUserName(user.UserName, false);
            if (entity != null) throw new Exception("User is already registered");

            var dbUser = user.ProjectedAs<User, int>();

            dbUser.Password = PasswordHash.CreateHash(password);
            Repository.Add(dbUser);

            Repository.UnitOfWork.Commit();

            return dbUser.ProjectedAs<UserDTO, int>();
        }