예제 #1
0
        public void CreateUser(UserBll user)
        {
            if (user == null)
                throw new ArgumentNullException("user");

            var userDal = user.ToDal();
            
            repository.Create(userDal);
            uow.Commit();
        }
예제 #2
0
        public void UpdateUser(UserBll user)
        {
            if (user == null)
                throw new ArgumentNullException("user");

            UserDal currentUser = user.ToDal();
            UserDal existedUser = repository.GetById(user.Id);
            if (existedUser == null)
                throw new EntityNotFoundException("user", user.Id);
            
            existedUser.Username = currentUser.Username;
            existedUser.Email = currentUser.Email;
            existedUser.Password = currentUser.Password;

            repository.Update(existedUser);
            uow.Commit();
        }