Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var comment = this.moderatorComments
                          .GetCommentById(id)
                          .FirstOrDefault();

            var editCommentViewModel = new ModeratorEditCommentViewModel
            {
                Content = comment.Content,
                Status  = comment.Status
            };

            return(this.View(editCommentViewModel));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, ModeratorEditCommentViewModel viewModel)
        {
            if (viewModel != null && ModelState.IsValid)
            {
                var comment = this.moderatorComments
                              .GetCommentById(id)
                              .FirstOrDefault();

                this.moderatorComments.Edit(comment, viewModel);

                this.TempData["Message"] = string.Format(GlobalConstants.SuccessMessage, " Edited Comment.");

                return(this.RedirectToAction("Index", "ModeratorComments", new { area = "Moderator" }));
            }

            this.TempData["Message"] = string.Format(GlobalConstants.FailMessage, " Edited Comment.");

            return(this.View(viewModel));
        }