public ActionResult DelById(int id, int Page = 1) { string str = ""; string linkname = DNTRequest.GetString("linkname"); hx_td_Links pDel = new hx_td_Links() { Linkid = id }; ef.hx_td_Links.Attach(pDel); ef.hx_td_Links.Remove(pDel); int i = ef.SaveChanges(); if (i > 0) { str = StringAlert.Alert("友情链接删除成功!", "/admin/Link?page=" + Page.ToString() + "&linkname=" + linkname); CacheRemove.ReMovetd_web_Links(); } else { str = StringAlert.Alert("友情链接删除失败!", "/admin/Link?page=" + Page.ToString()); } return(Content(str, "text/html")); }
public ActionResult DelById(int id, int Page = 1) { string str = ""; string adname = DNTRequest.GetString("adname"); hx_td_Ad pDel = new hx_td_Ad() { Adid = id }; ef.hx_td_Ad.Attach(pDel); ef.hx_td_Ad.Remove(pDel); int i = ef.SaveChanges(); if (i > 0) { str = StringAlert.Alert("广告删除成功!", "/admin/Ad/Index?page=" + Page.ToString() + "&adname=" + adname); CacheRemove.RemoveWebAdtype(); //请除广告位缓存 } else { str = StringAlert.Alert("广告删除失败!", "/admin/Ad/Index?page=" + Page.ToString() + "&adname=" + adname); } return(Content(str, "text/html")); }
public ActionResult Edit(hx_td_Links p) { string str = ""; int page = DNTRequest.GetInt("page", 1); string[] proNames; proNames = new string[] { "Linkname", "LinkUrl", "LinkType", "LinkLogo", "Linkstate" }; p = (hx_td_Links)Utils.ValidateModelClass(p); p.LinkLogo.Replace("//", "/"); DbEntityEntry entry = ef.Entry <hx_td_Links>(p); entry.State = EntityState.Unchanged; foreach (string ProName in proNames) { entry.Property(ProName).IsModified = true; } int i = ef.SaveChanges(); if (i > 0) { str = StringAlert.Alert("友情链接修改成功!", "/admin/Link?page=" + page.ToString()); } else { str = StringAlert.Alert("友情链接修改失败!", "/admin/Link/Edit/" + p.Linkid + "/"); } CacheRemove.ReMovetd_web_Links(); return(Content(str, "text/html")); }
public ActionResult AddHelpPost(hx_td_about_news p, int rootid, string context) { p = (hx_td_about_news)Utils.ValidateModelClass(p); p.context = context; p.createtime = DateTime.Now; p.newimg = p.newimg.Replace("//", "/"); p.comm = 0; p.listcomm = 0; p.adminuserid = 0; ef.hx_td_about_news.Add(p); //ef.SaveChanges(); string str = ""; int i = ef.SaveChanges(); if (i > 0) { CacheRemove.RemoveWebCache("NewsList"); str = StringAlert.Alert("添加成功!", "/admin/Help/Index?rootid=" + rootid); } else { str = StringAlert.Alert("添加失败!", "/admin/Help/Add?rootid=" + rootid); } return(Content(str, "text/html")); }
public ActionResult SetCommtate(int id, int state, int commtype) { string json = "{\"ret\":0,\"msg\":\"操作失败\"}"; if (id < 1) { json = "{\"ret\":-1,\"msg\":\"参数错误\"}"; } else { var i = 0; if (commtype == 1) { i = ef.hx_td_about_news.Where(a => a.newid == id).Update(a => new hx_td_about_news { comm = state }); //首页推荐 } else { i = ef.hx_td_about_news.Where(a => a.newid == id).Update(a => new hx_td_about_news { listcomm = state }); //首页推荐 } if (i > 0) { CacheRemove.RemoveWebCache("NewsList"); json = "{\"ret\":1,\"msg\":\"操作成功\"}"; } } return(Content(json, "text/json")); }
public ActionResult DelById(int id, int Page = 1, int rootid = 0, string news_title = "") { string str = ""; hx_td_about_news pDel = new hx_td_about_news() { newid = id }; ef.hx_td_about_news.Attach(pDel); ef.hx_td_about_news.Remove(pDel); int i = ef.SaveChanges(); if (i > 0) { CacheRemove.RemoveWebCache("NewsList"); str = StringAlert.Alert("帮助中心删除成功!", "/admin/Help/Index?page=" + Page.ToString() + "&rootid=" + rootid.ToString() + "&news_title=" + news_title); } else { str = StringAlert.Alert("帮助中心删除失败!", "/admin/Help/Index?page=" + Page.ToString() + "&rootid=" + rootid.ToString() + "&news_title=" + news_title); } return(Content(str, "text/html")); }
public ActionResult EditHelpPost(hx_td_about_news p, int rootid = 0, int page = 1, string context = "") { string str = ""; string[] proNames; proNames = new string[] { "News_title", "web_Type_menu_id", "News_Key", "news_Des", "context" }; p = (hx_td_about_news)Utils.ValidateModelClass(p); p.context = context; p.newimg = p.newimg.Replace("//", "/"); DbEntityEntry entry = ef.Entry <hx_td_about_news>(p); entry.State = EntityState.Unchanged; foreach (string ProName in proNames) { entry.Property(ProName).IsModified = true; } int i = ef.SaveChanges(); if (i > 0) { CacheRemove.RemoveWebCache("NewsList"); str = StringAlert.Alert("帮助中心修改成功!", "/Admin/help/index?page=" + page + "&rootid=" + rootid); } else { str = StringAlert.Alert("帮助中心修改失败!", "/admin/help/Edit?id=" + p.newid + "&rootid=" + rootid + "&page=" + page); } return(Content(str, "text/html")); }
public ActionResult AddAdpost(hx_td_Ad p) { p = (hx_td_Ad)Utils.ValidateModelClass(p); p.AdPath = p.AdPath.Replace("//", "/"); p.Adcreatetime = DateTime.Now; ef.hx_td_Ad.Add(p); ef.SaveChanges(); CacheRemove.RemoveWebAdtype(); //请除广告位缓存 return(RedirectToAction("index", "Ad")); }
public ActionResult AddLinkpost(hx_td_Links p) { p = (hx_td_Links)Utils.ValidateModelClass(p); p.LinkLogo.Replace("//", "/"); p.createtime = DateTime.Now; ef.hx_td_Links.Add(p); ef.SaveChanges(); CacheRemove.ReMovetd_web_Links(); return(RedirectToAction("index", "Link")); }
public ActionResult EditAdpost(hx_td_Ad p) { string str = ""; string[] proNames; proNames = new string[] { "AdName", "AdTypeId", "AdPath", "AdLink", "AdState" }; p = (hx_td_Ad)Utils.ValidateModelClass(p); p.AdPath = p.AdPath.Replace("//", "/"); DbEntityEntry entry = ef.Entry <hx_td_Ad>(p); entry.State = EntityState.Unchanged; foreach (string ProName in proNames) { entry.Property(ProName).IsModified = true; } int i = ef.SaveChanges(); if (i > 0) { str = StringAlert.Alert("广告修改成功!", "/admin/Ad/Index"); } else { str = StringAlert.Alert("广告修改失败!", "/admin/Ad/EditAd/" + p.Adid + "/"); } CacheRemove.RemoveWebAdtype(); //请除广告位缓存 return(Content(str, "text/html")); }
public ActionResult RemoveAllCache() { CacheRemove.ClearAllCache(); RemoveAllWebSiteCache(); return(Content(StringAlert.Alert("缓存清除成功"))); }
public ActionResult RemoveAllCache() { CacheRemove.ClearAllCache(); return(Content("缓存清除成功")); }