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; }
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 PostingCommentSucceeded(Post post) { const string successMessage = "Your comment will be posted soon. Thanks!"; if (Request.IsAjaxRequest()) return Json(new {Success = true, message = successMessage}); TempData["message"] = successMessage; var postReference = post.MapTo<PostReference>(); return RedirectToAction("Details", new {Id = postReference.DomainId, postReference.Slug}); }
private string GetPostLink(Post post) { var postReference = post.MapTo<PostReference>(); return Url.RelativeToAbsolute(Url.Action("Details", "PostDetails", new { Id = postReference.DomainId, postReference.Slug })); }