Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void AddUser(string nickName, string password, string PrimaryMail, string userPhoto = null)
- {
- if (!IsDuplicateNickname(nickName))
- {
- var newUser = new User();
- newUser.NickName = nickName;
- newUser.Password = password;
- newUser.PrimaryMail = PrimaryMail;
- newUser.UserPhoto = userPhoto;
- using (var session = ConfigureRepository.SessionFactory.OpenSession())
- {
- using (var transaction = session.BeginTransaction())
- {
- try
- {
- session.Save(newUser);
- users.Add(newUser);
- transaction.Commit();
- }
- catch (HibernateException)
- {
- transaction.Rollback();
- }
- }
- }
- }
- else throw new DuplicateValueException();
- }
Add Comment
Please, Sign In to add comment