/// <summary> /// The Index page should load the show all courses page. /// For the purposes of Create, should be a teacher or no see. /// For the purposes of Edit, should be course teacher. /// For the purpose of Delete, should be course teacher. /// For the purpose of Display(Index) should display all courses either registered or all courses. /// </summary> /// <returns></returns> public IActionResult Index() { List <Course> courses = new List <Course>(); List <CourseViewModel> cvms = new List <CourseViewModel>(); CourseViewModel cvm = null; courses = (List <Course>)_courseDAL.GetCourses(); foreach (Course item in courses) { cvm = new CourseViewModel() { Description = item.Description, EstimatedDuration = item.EstimatedDuration, Id = item.Id, Name = item.Name, TeacherFirstName = item.TeacherFirstName, TeacherId = item.TeacherId, TeacherLastName = item.TeacherLastName, Category = item.CategoryName }; cvms.Add(cvm); } return(View(cvms)); }
public static void RenderListViewDataCourses(ListView lvwCourse) { lvwCourse.Items.Clear(); List <Course> courses = CourseDAL.GetCourses(); foreach (Course course in courses) { lvwCourse.Items.Add(CourseModelToListViewItem(course)); } }
public static void RenderComboBoxDataCourses(ComboBox cboCourse) { cboCourse.Items.Clear(); List <Course> courses = CourseDAL.GetCourses(); foreach (Course course in courses) { cboCourse.Items.Add(course); } }
/// <summary> /// 根据教师ID,查询教师开的课程 /// </summary> /// <param name="TID">教师ID</param> /// <returns></returns> public List <Course> GetCourses(string TID) { return(dal.GetCourses(TID)); }
public Task <List <Course> > GetCoursesAsync() { return(Task.FromResult(CourseDAL.GetCourses())); //return Task.FromResult(_courses); }
// Hämtar samtliga banor public IEnumerable <Course> GetCourses() { return(CourseDAL.GetCourses()); }