public ActionResult Search() { if (Session["AdminData"] == null) { return(RedirectToAction("Login", "Admin")); } else { var model = new OrganizationCreateForView(); model.Detailsid = _orgId; model.OrganizationList = _organizationBll.GetAll(); for (int i = 0; i < model.OrganizationList.Count; i++) { var id = model.OrganizationList[i].Id; var modelCourse = new CourseCreateForView(); modelCourse.CourseList = _courseBll.GetAll(); model.OrganizationList[i].CourseTotal = _courseBll.QueryableCourse().Count(c => c.Organizationid == id); } return(View(model)); } }