Beispiel #1
0
        public async Task <IActionResult> Edit(int id)
        {
            //Get post and track for reply
            var postReplyReply = _postReplyReplyService.GetById(id);

            ViewBag.JumpToDivId = postReplyReply.PostReply.Id;

            //Get the application user that will write the reply for this post
            var user = await _userManager.FindByNameAsync(User.Identity.Name);

            var model = new PostReplyReplyEditModel
            {
                Id             = postReplyReply.Id,
                AuthorName     = User.Identity.Name,
                AuthorImageUrl = user.ImageUrl,
                AuthorId       = user.Id,
                AuthorRating   = user.Rating,
                IsAuthorAdmin  = User.IsInRole("Admin"),

                ReplyContent = postReplyReply.Content,

                EditedCreatedDate = DateTime.Now,
                VoteCount         = postReplyReply.VoteCount,
                IsEdited          = postReplyReply.IsEdited,

                PostId      = postReplyReply.Post.Id,
                PostReplyId = postReplyReply.PostReply.Id
            };

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> AddEditContent(PostReplyReplyEditModel model)
        {
            await _postReplyReplyService.EditPostReplyContent(model.Id, model.ReplyContent);

            //ViewBag.JumpToDivId = model.PostReplyId;

            return(RedirectToAction("Index", "Post", new { id = model.PostId }));
        }