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); }
public ChapterViewModel(TopicViewModel _curTopic, Chapter _curChapter) { currentChapter = _curChapter; currentTopic = _curTopic; }
private string chapterImage = string.Empty; //SDI: the image is local to the viewmodel for simplification public ChapterViewModel(TopicViewModel _curTopic) { currentChapter = new Chapter(); currentTopic = _curTopic; }