private ActionResult PostingCommentSucceeded(Post post, CommentInput input) { const string successMessage = "Your comment will be posted soon. Thanks!"; if (Request.IsAjaxRequest()) return Json(new { Success = true, message = successMessage }); TempData["new-comment"] = input; var postReference = post.MapTo<PostReference>(); return Redirect(Url.Action("Details", new { Id = postReference.DomainId, postReference.Slug, key = post.ShowPostEvenIfPrivate }) + "#comments-form-location"); }
private ActionResult PostingCommentFailed(Post post, CommentInput input, Guid key) { if (Request.IsAjaxRequest()) return Json(new { Success = false, message = ModelState.FirstErrorMessage() }); var postReference = post.MapTo<PostReference>(); var result = Details(postReference.DomainId, postReference.Slug, key); var model = result as ViewResult; if (model != null) { var viewModel = model.Model as PostViewModel; if (viewModel != null) viewModel.Input = input; } return result; }