我在控制器中定义了变量列表effectedCourseInstances
,并在ProcessCourseApplicationURL()
方法中为其赋值,但在从视图往返后,列表不再保持值null
。我想确保我可以在effectedCourseInstances
方法中访问指定的值GetAllProcessedURLCourses()
。我在哪里做错????
public class CourseManagementController : Controller
{
private List<CourseInstanceModel> _effectedCourseInstances;
[HttpPost]
public ActionResult ProcessCourseApplicationURL(CourseApplicationsURLFeed_Model obj)
{
try
{
if (ModelState.IsValid)
{
_effectedCourseInstances = _coursesServices.ProcessAllCoursesApplicationURL(obj);
}
}
catch (DataException ex)
{
ModelState.AddModelError("", "Unable To Process Courses Application URL from CID DB" + ex);
}
return PartialView("CourseApplicationURLTest_Partial", _effectedCourseInstances);
} //end
public ActionResult GetAllProcessedURLCourses([DataSourceRequest]DataSourceRequest request)
{
DataSourceResult CourseInstances_Feed_Result = _effectedCourseInstances.ToDataSourceResult(request);
return Json(CourseInstances_Feed_Result, JsonRequestBehavior.AllowGet);
}
}