Exemple #1
0
        public async Task <IActionResult> PostsOrderedByDate(string threadId)
        {
            var posts = await forumThreadPostRepository.PostsOrderedByDateAsync(threadId);

            var thread = await forumThreadRepository.FindById(threadId);

            return(Ok(new
            {
                threadTitle = thread.Title,
                posts = posts.ToEnumerable()
                        .Select(x => new ForumThreadPostModel
                {
                    Id = x.Id,
                    Author = x.Author,
                    CreationDate = x.CreationDate,
                    Text = x.Text,
                })
            }));
        }
 public ForumThread FindById(int id)
 {
     return(_mapper.Map <ForumThread>(_forumThreadRepository.FindById(id)));
 }
        public async Task <IActionResult> Thread(Guid id)
        {
            var thread = await _threadRepo.FindById(id);

            return(View(thread));
        }