public List <SelectListItem> GetCourseListItem() { var courseList = trainerManager.GetCourses(); List <SelectListItem> courseStItems = new List <SelectListItem>(); foreach (var courses in courseList) { var osli = new SelectListItem(); osli.Text = courses.CourseName; osli.Value = courses.Id.ToString(); courseStItems.Add(osli); } return(courseStItems); }