public ActionResult DeleteBlog(int id) { AjaxActionReturn ajaxActionReturn = new AjaxActionReturn(); try { this.blogRepository.Delete(id); return(GetAllBlogs()); } catch (Exception ex) { ajaxActionReturn.ActionSuccess = false; ajaxActionReturn.ErrorMessage = ex.Message; } return(this.Json(ajaxActionReturn, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateBlog(Blog blogData) { AjaxActionReturn ajaxActionReturn = new AjaxActionReturn(); try { blogData.BlogTime = DateTime.Now; this.blogRepository.SaveOrUpdate(blogData); return(GetAllBlogs()); } catch (Exception ex) { ajaxActionReturn.ActionSuccess = false; ajaxActionReturn.ErrorMessage = ex.Message; } return(this.Json(ajaxActionReturn, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAllBlogs() { AjaxActionReturn ajaxActionReturn = new AjaxActionReturn(); try { var blogs = this.blogRepository.GetAll().OrderByDescending(t => t.BlogTime); ajaxActionReturn.ActionSuccess = true; ajaxActionReturn.HtmlResult = RenderPartialViewToString("BlogsTable", blogs); } catch (Exception ex) { ajaxActionReturn.ActionSuccess = false; ajaxActionReturn.ErrorMessage = ex.Message; } return(this.Json(ajaxActionReturn, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAllBlogs() { AjaxActionReturn ajaxActionReturn = new AjaxActionReturn(); try { var blogs = this.blogRepository.GetAll().OrderByDescending(t => t.BlogTime); ajaxActionReturn.ActionSuccess = true; ajaxActionReturn.HtmlResult = RenderPartialViewToString("BlogsTable", blogs); } catch (Exception ex) { ajaxActionReturn.ActionSuccess = false; ajaxActionReturn.ErrorMessage = ex.Message; } return this.Json(ajaxActionReturn, JsonRequestBehavior.AllowGet); }
public ActionResult DeleteBlog(int id) { AjaxActionReturn ajaxActionReturn = new AjaxActionReturn(); try { this.blogRepository.Delete(id); return GetAllBlogs(); } catch (Exception ex) { ajaxActionReturn.ActionSuccess = false; ajaxActionReturn.ErrorMessage = ex.Message; } return this.Json(ajaxActionReturn, JsonRequestBehavior.AllowGet); }
public JsonResult UpdateBlog(Blog blogData) { AjaxActionReturn ajaxActionReturn = new AjaxActionReturn(); try { blogData.BlogTime = DateTime.Now; this.blogRepository.SaveOrUpdate(blogData); return GetAllBlogs(); } catch (Exception ex) { ajaxActionReturn.ActionSuccess = false ; ajaxActionReturn.ErrorMessage = ex.Message; } return this.Json(ajaxActionReturn, JsonRequestBehavior.AllowGet); }