I have a controller in ASP.NET MVC application.
private GipDbContext db = new GipDbContext();
private Employee employeeObj;
public ActionResult Edit(int? id)
{
Employee employee = db.Employees.Find(id);
//employeeObj SET TO ANOTHER OBJECT
employeeObj = employee;
return View(employee);
}
public PartialViewResult TimeSeriesData(int? tsdataid)
{
TimeSeriesData tsobject = new TimeSeriesData();
// employeeObj RETURNING NULL
foreach (var item in employeeObj.TimeSeriesData){
if (item.TimeSeriesDataID == tsdataid)
{
tsobject = item;
break;
}
}
The first method being called is Edit, then when TimeSeriesData is called employeeObj is returning null, even though it was set in the Edit method.. any ideas why?