我想将值插入到 db。
我的模型是
public bool Create(string userName) {
_userNA = userName;
if (validate()) {
using (DatabaseCommaned cmd = new DatabaseCommaned()) {
cmd.CommandText = "INSERT INTO tUser(UNA, FNAID, MNAID, LNAID, Email, MobCountryCode, Mobile, ST, LN, ExpDT) VALUES(@una, @fnaid, @mnaid, @lnaid, @email, @mobCode, @mobile, @st, @ln, @exp)";
cmd.Parameters.AddWithValue("@una", userName);
....
_userID = cmd.ExecuteInsertAndGetID();
if (_userID > 0) {
copyPropertiesInternally();
Logs.LogEvent(LogEvent.UserCreated, userName);
ResetPassword();
return true;
}
else {
_userNA = string.Empty;
return false;
}
}
}
else
return false;
}
谁能告诉控制器是如何为上述模型编写的