Esempio n. 1
0
 partial void DeleteUser(User instance);
Esempio n. 2
0
 partial void InsertUser(User instance);
Esempio n. 3
0
 partial void UpdateUser(User instance);
Esempio n. 4
0
        private int CreateUser(string username, string password, string email)
        {
            var user = (from u in Context.Users
                        where u.name == username
                        //&& u.password == password
                        select u).FirstOrDefault();

            if (user != null)
            {
                return 2; //user with same name exist
            }
            else {
                RegexUtilities r = new RegexUtilities();

                if (!r.IsValidEmail(email)) {
                    return 3; //non-valid email address
                }
                var newUser = new User();
                newUser.name = username;
                newUser.password = password;
                newUser.email = email;
                newUser.roles = "user";

                Context.Users.InsertOnSubmit(newUser);
                Context.SubmitChanges();
                return 1; //user record not found
            }
        }