public virtual ActionResult Index(BlogConfig config) { if (ModelState.IsValid == false) { ViewBag.Message = ModelState.FirstErrorMessage(); if (Request.IsAjaxRequest()) { return(Json(new { Success = false, ViewBag.Message })); } return(View(BlogConfig)); } var current = RavenSession.Load <BlogConfig>(BlogConfig.Key); if (IsFuturePostsEncryptionOptionsChanged(current, config)) { RemoveFutureRssAccessOnEncryptionConfigChange(); } RavenSession.Advanced.Evict(current); RavenSession.Store(config, BlogConfig.Key); RavenSession.SaveChanges(); OutputCacheManager.RemoveItem(MVC.Section.Name, MVC.Section.ActionNames.ContactMe); ViewBag.Message = "Configurations successfully saved!"; if (Request.IsAjaxRequest()) { return(Json(new { Success = true, ViewBag.Message })); } return(View(config)); }
private static void ClearUserCache(string username) { var outputCacheManager = new OutputCacheManager(); outputCacheManager.RemoveItem("Home", "Index", new { username = username }); }
public virtual async Task <ActionResult> Comment(CommentInput input, string id, Guid key) { if (ModelState.IsValid == false) { return(RedirectToAction("Details")); } if (IsIpAddressBlocked()) { return(new HttpStatusCodeResult(HttpStatusCode.PaymentRequired)); } var post = RavenSession .Include <Post>(x => x.CommentsId) .Load("posts/" + id); if (post == null || post.IsPublicPost(key) == false) { return(HttpNotFound()); } var comments = RavenSession.Load <PostComments>(post.CommentsId); if (comments == null) { return(HttpNotFound()); } var commenter = RavenSession.GetCommenter(input.CommenterKey); if (commenter == null) { input.CommenterKey = Guid.NewGuid(); } ValidateCommentsAllowed(post, comments); await ValidateCaptcha(input, commenter); if (ModelState.IsValid == false) { return(PostingCommentFailed(post, input, key)); } TaskExecutor.ExcuteLater(new AddCommentTask(input, Request.MapTo <AddCommentTask.RequestValues>(), id)); CommenterUtil.SetCommenterCookie(Response, input.CommenterKey.MapTo <string>()); OutputCacheManager.RemoveItem(SectionController.NameConst, MVC.Section.ActionNames.List); return(PostingCommentSucceeded(post, input)); }
public virtual ActionResult Index(BlogConfig config) { if (ModelState.IsValid == false) { ViewBag.Message = ModelState.FirstErrorMessage(); if (Request.IsAjaxRequest()) { return(Json(new { Success = false, ViewBag.Message })); } return(View(BlogConfig)); } RavenSession.Store(config, "Blog/Config"); OutputCacheManager.RemoveItem(MVC.Section.Name, MVC.Section.ActionNames.ContactMe); ViewBag.Message = "Configurations successfully saved!"; if (Request.IsAjaxRequest()) { return(Json(new { Success = true, ViewBag.Message })); } return(View(config)); }
public ActionResult ExpireSimpleDonutOneCache() { OutputCacheManager.RemoveItem("Home", "SimpleDonutOne"); return(Content("OK", "text/plain")); }
public ActionResult ExpireAreaDonutOne() { OutputCacheManager.RemoveItem("SubHome", "AreaDonutOne", new { area = "SubArea" }); return(Content("OK", "text/plain")); }