public List <ChapterViewModel> GetChaptersVM()
        {
            List <Chapter>          AllChapters   = Repository.GetChapters().ToList();
            List <ChapterViewModel> AllChaptersVM = new List <ChapterViewModel>();

            if (AllChaptersVM != null)
            {
                foreach (Chapter chapter in AllChapters)
                {
                    ChapterViewModel tvm = new ChapterViewModel(currentTopic);
                    tvm.ChapterId    = chapter.ID;
                    tvm.ChapterName  = chapter.Name;
                    tvm.ChapterImage = "ChapterImage.png"; //SDI:Same image for all Chapters
                    AllChaptersVM.Add(tvm);
                }
            }
            return(AllChaptersVM);
        }
        public List <ChapterViewModel> GetChaptersForTopicVM(TopicViewModel selTopic)
        {
            List <Chapter>          AllChapters   = Repository.GetChaptersByTopicId(selTopic.TopicId).ToList();
            List <ChapterViewModel> AllChaptersVM = new List <ChapterViewModel>();

            if (AllChaptersVM != null)
            {
                foreach (Chapter chapter in AllChapters)
                {
                    ChapterViewModel cvm = new ChapterViewModel(currentTopic);
                    cvm.ChapterId      = chapter.ID;
                    cvm.ChapterName    = chapter.Name;
                    cvm.ChapterImage   = "ChapterImage.png"; //SDI:Same image for all Chapters
                    cvm.ChapterTopicId = chapter.TopicId;
                    //cvm.CurrentTopic = new TopicViewModel().ge
                    AllChaptersVM.Add(cvm);
                }
            }
            return(AllChaptersVM);
        }
示例#3
0
 public QuestionAnswerViewModel(ChapterViewModel _curChapter)
 {
     this.currentChapterVM = _curChapter;
     this.CurrentChapter   = new Chapter();
     this.CurrentQuestion  = new Question();
 }