Hi!
How I can get list element from list first method and use it from second method list.
public List<string> Get_Application(string app_id)
{
List<string> applicationList = new List<string>();
OracleCommand cmd = new OracleCommand();
OracleConnection cn = new OracleConnection(oracleConnection);
try
{
cn.Open();
OracleDataAdapter da = new OracleDataAdapter();
cmd.Connection = cn;
cmd.CommandText = "GET_APPL_INFO";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("app_id", OracleDbType.Varchar2).Value = app_id;
cmd.Parameters.Add("c_cur", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
da.SelectCommand = cmd;
DataTable dt = new DataTable();
da.Fill(dt);
foreach (DataRow dr in dt.Rows)
{
applicationList.Add(dr[0].ToString());
applicationList.Add(dr[1].ToString());
applicationList.Add(RequestPercentDinamic(Convert.ToInt32(app_id)).ToString());
applicationList.Add(dr[3].ToString());
applicationList.Add(dr[4].ToString());
applicationList.Add(dr[5].ToString());
applicationList.Add(dr[6].ToString());
applicationList.Add(dr[7].ToString());
applicationList.Add(dr[8].ToString());
applicationList.Add(dr[9].ToString());
}
}
catch (Exception ex) { }
finally
{
cn.Close();
cmd.Dispose();
}
return applicationList;
}
In seond method I can't get.
public async Task<ActionResult> sendToZipl(int app)
{
if (app > 0)
{
string appId = app.ToString();
DeclAgroController decController = new DeclAgroController();
var applicationList = decController.Get_Application(appId);
ZyplViewModel data = new ZyplViewModel();
foreach(var appl in applicationList)
{
data.age = appl.age
};
}
return null;
}
The result I want like below:
foreach(var appl in applicationList)
{
data.age = appl.age
data.gender = appl.gender
data.sector = appl.sector
};