0

Developing MVC4 application and using Register that comes with MVC5 framework. I updated register.cshtml and added a new column called Language. I also updated the RegisterModel class to hold my value. Register model has all the values including my property (language).

Now I like to grab this values from Register Model and plug into CreateUser.

MyProperty is model.Language

[HttpPost]
publıc ActıonResult Register(RegisterModel model)
{
    Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, Guid.NewGuid(), out status)
}

What would be the best way to grab this value and store in database? I really like to store in Users table where UserID and UserName exists.

4

1 回答 1

1

WebSecurity.CreatUserAndAccount诀窍是通过调用传递附加列的语法。尝试这个:

WebSecurity.CreateUserAndAccount(model.UserName,model.Password,
new {Language = model.Language
});

这里有完整的描述。

于 2012-10-31T04:22:29.000 回答