public JsonResult GetCourseByOrganizationId(int id) { var courses = new List <Course>(); var dataList = examManager.GetOrganizationById(id); foreach (var organization in dataList) { courses.AddRange(organization.Courses); } return(Json(courses.Select(c => new { c.Id, c.CourseName }), JsonRequestBehavior.AllowGet)); }