我想插入值到數據庫。控制器操作
我的模型是
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;
}
有誰能夠告訴如何控制器被寫在上面的模型
你的命名約定吸.. –
@BhushanFirake遺憾。你可以告訴我從控制器通過哪些值 – user2495593
它很不清楚你在問什麼.. –