예제 #1
0
        public CommentPage(Models.Menu menu)
        {
            InitializeComponent();

            this.ViewModel = new CommentPageViewModel(menu)
            {
                Title = this.Title
            };
            this.BindingContext = this.ViewModel;
        }
예제 #2
0
        public async Task <IActionResult> View(int linkId, int id, CancellationToken ct)
        {
            _logger.LogInformation($"Comments.View({linkId}, {id})");
            var comment = await _comments.Get(linkId, id, ct);

            if (comment == null)
            {
                return(NotFound());
            }
            var viewModel = new CommentPageViewModel
            {
                Comment    = comment,
                NewComment = new Comment
                {
                    LinkId    = linkId,
                    ReplyToId = id
                }
            };

            return(View(viewModel));
        }
예제 #3
0
        public async Task <IActionResult> MediaDiscussion(string discussionId, int page = 1)
        {
            var comments = await this.discussionsService.GetComments <CommentViewModel>(discussionId, page, DiscussionsPerPage);

            var totalComments = await this.discussionsService.GetTotalComments(discussionId);

            var discussionTitle = await this.discussionsService.GetDiscussionTitle(discussionId);

            var discussionMedia = await this.discussionsService.GetDiscussionMedia(discussionId);

            var inputModel = new CommentPageViewModel()
            {
                TotalResults    = totalComments,
                TotalPages      = (int)Math.Ceiling(decimal.Divide(totalComments, DiscussionsPerPage)),
                CurrentPage     = page,
                Comments        = comments,
                DiscussionTitle = discussionTitle,
                MediaId         = discussionMedia,
                DiscussionId    = discussionId,
            };

            return(this.View("~/Views/Discussions/Comments.cshtml", inputModel));
        }