Exemplo n.º 1
0
        public async Task <IActionResult> CommentOnPhoto(Guid id)
        {
            CommentsViewModel model    = new CommentsViewModel(id);
            List <Comment>    comments = await _repository.GetCommentsAsync(id);

            List <Comment> sorted = comments.OrderByDescending(c => c.DateCreated).ToList();

            foreach (Comment comment in comments)
            {
                //comment.Commentator.Username = _repository.GetUser(comment.Commentator.Id).Username;
                model.Comments.Add(comment);
            }
            _repository.SaveLastCommented(id);
            return(View(model));
        }