/// <summary> /// Blog tool view /// </summary> /// <param name="GUID"></param> /// <returns></returns> public ActionResult BlogTool(string GUID) { if (!(String.IsNullOrEmpty(GUID)) && GUID.Equals(AdminToolsGUID)) { BlogService svc = new BlogService(); List<BlogTbl> model = svc.ReadAllBlogItems(); return View(model); } else { return Redirect("/Home/Index"); } }
/// <summary> /// /// </summary> /// <param name="GUID"></param> /// <param name="Id"></param> /// <returns></returns> public ActionResult BlogEntry(string GUID , int Id) { if (!(String.IsNullOrEmpty(GUID)) && GUID.Equals(AdminToolsGUID)) { BlogService svc = new BlogService(); if (Id == 0) { return View(); } else { BlogDataModel model = svc.ReadBlogModelItemByID(Id); return View(model); } } else { return Redirect("/Home/Index"); } }
/// <summary> /// Blog view /// </summary> /// <returns></returns> public ActionResult Blog() { ViewBag.Message = "Blog"; BlogService svc = new BlogService(); List<BlogFileTbl> fileTbl = svc.ReadAllBlogFiles(); List<BlogTbl> blogTbl = svc.ReadAllBlogItems(); List<BlogDataModel> blogList = new List<BlogDataModel>(); foreach (BlogTbl blogItem in blogTbl) { BlogDataModel model = new BlogDataModel(); foreach (BlogFileTbl fileItem in fileTbl) { if (fileItem.BlogId == blogItem.Id) { model.FileData = fileItem.FileData.ToArray(); } } //Assigning values to blog model model.BlogTitle = blogItem.BlogTitle; model.BlogContent = blogItem.BlogContent; model.DateCreated = (DateTime)blogItem.DateCreated; blogList.Add(model); } return View(blogList); }
public ActionResult EditBlogEntry(BlogDataModel model) { BlogService svc = new BlogService(); svc.EditBlogRecord(model); return Redirect("/Account/BlogTool?GUID=" + AdminToolsGUID); }
/// <summary> /// Delete blog view /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult DeleteBlogEntry(int id) { BlogService svc = new BlogService(); svc.DeleteBlogRecord(id); return Redirect("/Account/BlogTool?GUID=" + AdminToolsGUID); }