public ActionResult ViewAllAssignedTeachers(int?messageFromEdit) { CourseAssignManager aCourseAssignManager = new CourseAssignManager(); List <CourseAssignToTeacherModel> CourseAssignToTeachers = new List <CourseAssignToTeacherModel>(); CourseAssignToTeachers = aCourseAssignManager.GetAllCourseAssignedTeachers(); //return View(CourseAssignToTeachers); if (CourseAssignToTeachers.Count == 0) { string message = "No data in the database for AssignedTeacher"; ViewBag.MessageViewCourses = message; } else if (messageFromEdit > 0) { ViewBag.MessageViewCourses = "AssignedTeacher Updated Successfully"; } ViewBag.CourseAssignToTeacherModelList = CourseAssignToTeachers; return(View()); }