コード例 #1
0
 partial void DeleteUser(User instance);
コード例 #2
0
 partial void InsertUser(User instance);
コード例 #3
0
 partial void UpdateUser(User instance);
コード例 #4
0
        public User AddUser(RegisterViewModel viewModel)
        {
            User newUser = new User();

            newUser.DateAdded = DateTime.Now;
            newUser.YearOfBirth = viewModel.dobYear;
            newUser.Location = viewModel.county;
            newUser.LastLoginDate = DateTime.Now;
            newUser.UserRating = 0;
            newUser.Username = viewModel.username;
            newUser.Password = viewModel.password;
            newUser.Alias = viewModel.username;
            newUser.Email = viewModel.email;
            newUser.Stereotype = "NULL!";

            if (viewModel.gender == "1")
                newUser.Male = true;
            else if (viewModel.gender == "0")
                newUser.Male = false;

            db.Users.InsertOnSubmit(newUser);
            db.SubmitChanges();
            return newUser;
        }