public ActionResult Create(GlobalModel GlobalModel)
{
try
{
using (OracleConnection conn = new OracleConnection(_connectionString))
{
conn.Open();
string vSql = " ";
foreach (var item in GlobalModel.user)
{
string[] val = item.Split("^");
vSql += " INSERT INTO USER(USERID, USERNAME ) VALUES('" + val[0] + "','" + val[1] + "'); ";
}
OracleCommand cmd = new OracleCommand();
using (cmd = new OracleCommand(vSql, conn))
cmd.ExecuteNonQuery();
}
return RedirectToAction(nameof(Index));
}
catch (Exception ex)
{
throw ex;
}//end try
}
Model.cs
public class GlobalModel
{
public List<USER> user { get; set; }
public IEnumerable<USER> Luser { get; set; }
}
public class USER
{
public string USERID { get; set; }
public string USERNAME { get; set; }
}