public ActionResult Edit(FormCollection input) {
            var viewModel = new CommentsEditViewModel();
            try {
                UpdateModel(viewModel);
                if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't edit comment")))
                    return new HttpUnauthorizedResult();

                _commentService.UpdateComment(viewModel.Id, viewModel.Name, viewModel.Email, viewModel.SiteName, viewModel.CommentText, viewModel.Status);
                return RedirectToAction("Index");
            } catch (Exception exception) {
                this.Error(exception, T("Editing comment failed: {0}", exception.Message), Logger, Services.Notifier);

                return View(viewModel);
            }
        }
예제 #2
0
        public ActionResult Edit(FormCollection input) {
            var viewModel = new CommentsEditViewModel();
            UpdateModel(viewModel);
            if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't edit comment")))
                return new HttpUnauthorizedResult();

            _commentService.UpdateComment(viewModel.Id, viewModel.Name, viewModel.Email, viewModel.SiteName, viewModel.CommentText, viewModel.Status);
            return RedirectToAction("Index");
        }
        public ActionResult Edit(int id) {
            try {
                CommentPart commentPart = _commentService.GetComment(id);
                var viewModel = new CommentsEditViewModel {
                    CommentText = commentPart.Record.CommentText,
                    Email = commentPart.Record.Email,
                    Id = commentPart.Record.Id,
                    Name = commentPart.Record.Author,
                    SiteName = commentPart.Record.SiteName,
                    Status = commentPart.Record.Status,
                };
                return View(viewModel);

            } catch (Exception exception) {
                this.Error(exception, T("Editing comment failed: {0}", exception.Message), Logger, Services.Notifier);

                return RedirectToAction("Index");
            }
        }
예제 #4
0
        public ActionResult Edit(int id) {
            CommentPart commentPart = _commentService.GetComment(id);
            if (commentPart == null)
                return new HttpNotFoundResult();

            var viewModel = new CommentsEditViewModel {
                CommentText = commentPart.Record.CommentText,
                Email = commentPart.Record.Email,
                Id = commentPart.Record.Id,
                Name = commentPart.Record.Author,
                SiteName = commentPart.Record.SiteName,
                Status = commentPart.Record.Status,
            };
            return View(viewModel);
        }