protected override void UpdateCache(Data.Models.Submission result) { CacheHandler.Instance.Remove(CachingKey.Submission(result.ID)); //Legacy item removal CacheHandler.Instance.Remove(DataCache.Keys.Submission(result.ID)); }
protected override void UpdateCache(CommandResponse <Data.Models.Submission> result) { if (result.Success) { CacheHandler.Instance.Remove(CachingKey.Submission(result.Response.ID)); } //Legacy item removal //CacheHandler.Instance.Remove(DataCache.Keys.Submission(result.ID)); }
protected override void UpdateCache(Data.Models.Submission result) { var key = CachingKey.Submission(result.ID); if (CacheHandler.Instance.Exists(key)) { CacheHandler.Instance.Replace <Submission>(key, x => { x.Title = result.Title; x.Content = result.Content; x.Url = result.Url; x.LastEditDate = result.LastEditDate; return(x); }); } //Legacy item removal //CacheHandler.Instance.Remove(DataCache.Keys.Submission(result.ID)); }
public async Task <ActionResult> EditSubmission(EditSubmission model) { var cmd = new EditSubmissionCommand(model.SubmissionId, new Domain.Models.UserSubmission() { Content = model.SubmissionContent }); var response = await cmd.Execute(); if (response.Success) { DataCache.Submission.Remove(model.SubmissionId); CacheHandler.Instance.Remove(CachingKey.Submission(model.SubmissionId)); return(Json(new { response = response.Response.FormattedContent })); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, response.Message)); } }
public async Task <ActionResult> EditSubmission([FromBody] EditSubmission model) { if (ModelState.IsValid) { var cmd = new EditSubmissionCommand(model.SubmissionId, new Domain.Models.UserSubmission() { Content = model.SubmissionContent }).SetUserContext(User); var response = await cmd.Execute(); if (response.Success) { DataCache.Submission.Remove(model.SubmissionId); CacheHandler.Instance.Remove(CachingKey.Submission(model.SubmissionId)); //return Json(new { response = response.Response.FormattedContent }); } return(JsonResult(response)); } return(JsonResult(CommandResponse.FromStatus(Status.Error, ModelState.GetFirstErrorMessage()))); }