Example #1
0
        public User AddUser(string userName, string password)
        {
            //we should really check if username exists.....
            using (UserDataContext dataContext = new UserDataContext())
            {

                User user = new User();
                user.Salt = PasswordHelper.GenerateSalt();
                user.UserName = userName;
                user.HashPassword = PasswordHelper.HashPassword(password, user.Salt);

                dataContext.Users.InsertOnSubmit(user);

                dataContext.SubmitChanges();

                //user.Id = (int)(decimal)cmd.ExecuteScalar();

                return user;
            }
        }
 partial void UpdateUser(User instance);
 partial void DeleteUser(User instance);
 partial void InsertUser(User instance);