コード例 #1
0
        private IEnumerable <Model.Section> GetSectionFromLectureList(IEnumerable <Lecture> lectures)
        {
            var sections = new List <Model.Section>();
            var welcome  = new Model.Section()
            {
                Name  = "Welcome",
                Order = 1,
            };
            var realLife = new Model.Section()
            {
                Name  = "Real life perspective",
                Order = 2,
            };
            var game = new Model.Section()
            {
                Name  = "Diving into CS:GO",
                Order = 3,
            };
            var quiz = new Model.Section()
            {
                Name  = "Quiz",
                Order = 4,
            };
            var practice = new Model.Section()
            {
                Name  = "Put it into practice",
                Order = 5,
            };
            var summary = new Model.Section()
            {
                Name  = "Summary",
                Order = 6,
            };

            foreach (var lec in lectures)
            {
                switch (lec.Section)
                {
                case Model.Lectures.Section.Welcome:
                    welcome.Lectures.Add(lec);
                    break;

                case Model.Lectures.Section.RealLife:
                    realLife.Lectures.Add(lec);
                    break;

                case Model.Lectures.Section.Quiz:
                    quiz.Lectures.Add(lec);
                    break;

                case Model.Lectures.Section.Game:
                    game.Lectures.Add(lec);
                    break;

                case Model.Lectures.Section.Practice:
                    practice.Lectures.Add(lec);
                    break;

                case Model.Lectures.Section.Summary:
                    summary.Lectures.Add(lec);
                    break;
                }
            }

            sections.Add(welcome);
            sections.Add(realLife);
            sections.Add(quiz);
            sections.Add(game);
            sections.Add(practice);
            sections.Add(summary);

            return(sections);
        }
コード例 #2
0
 internal void SetStudentList(Model.Section selectedItem)
 {
     StudentList = Repository.StudentRepository.GetAll(x => x.Id_section == selectedItem.Id);
 }
コード例 #3
0
 public MainWindowViewModel()
 {
     sectionList    = Repository.SectionRepository.GetAll();
     sectionList    = sectionList.OrderByDescending(x => x.Level).ThenBy(x => x.Name).ToList();
     CurrentSection = sectionList.First();
 }
コード例 #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.Section model)
 {
     return(dal.Update(model));
 }
コード例 #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Insert(Model.Section model)
 {
     return(dal.Insert(model));
 }
コード例 #6
0
 internal void SetTeacherList(Model.Section selectedItem)
 {
     TeacherList = Repository.LinkRepository.GetTeacherWithSubjectBySection(selectedItem.Id);
 }