Пример #1
0
        private void GetComment(object sender, GetByIdEventArgs e)
        {
            var comment = this.forumData.CommentsRepository.GetCommentById(e.Id);

            if (comment.IsVisible == true)
            {
                this.View.Model.Comment = comment;
            }
            else
            {
                this.View.Model.Error = "File not found!";
                return;
            }
        }
        private void GetAnswer(object sender, GetByIdEventArgs e)
        {
            var answer = this.forumData.AnswersRepository.GetAnswerById(e.Id);

            if (answer.IsVisible == true)
            {
                this.View.Model.Answer = answer;
            }
            else
            {
                this.View.Model.Error = "File not found!";
                return;
            }
        }
        private void GetThread(object sender, GetByIdEventArgs e)
        {
            var thread = this.forumData.ThreadsRepository.GetThreadById(e.Id);

            if (thread.IsVisible == true)
            {
                this.View.Model.Thread = thread;
            }

            var answers = this.forumData.AnswersRepository.GetAnswersByThreadId(e.Id).Where(a => a.IsVisible == true).ToList();

            foreach (var answer in answers)
            {
                answer.Comments.OrderBy(c => c.Published);
            }

            this.View.Model.Answers = answers;
        }
Пример #4
0
        private void GetThread(object sender, GetByIdEventArgs e)
        {
            var thread = this.forumData.ThreadsRepository.GetThreadById(e.Id);

            if (thread.IsVisible == true)
            {
                this.View.Model.Thread = thread;
            }
            else
            {
                this.View.Model.Error = "File not found!";
                return;
            }

            var sections = this.forumData.SectionsRepository.GetAllSections().ToList();

            foreach (var section in sections)
            {
                this.View.Model.Sections.Add(section.Name);
            }
        }