public ActionResult DeleteFriendlyLink(int id)
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            FriendlyLinkService friendlyLinkService = new FriendlyLinkService();

            friendlyLinkService.RemoveFriendlyLink(id);
            WitBird.Sex.Web.Cache.UpdateFriendlyLinks();//更新缓存

            return Redirect(Request.UrlReferrer.AbsoluteUri);
        }
        public ActionResult AddFriendlyLink(FriendlyLink friendlyLink)
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            if (friendlyLink != null)
            {
                if (!string.IsNullOrEmpty(friendlyLink.Name) &&
                    !string.IsNullOrEmpty(friendlyLink.Link) &&
                    friendlyLink.Sort > 0)
                {
                    FriendlyLinkService friendlyLinkService = new FriendlyLinkService();
                    friendlyLinkService.AddFriendlyLink(friendlyLink);
                    WitBird.Sex.Web.Cache.UpdateFriendlyLinks();//更新缓存
                }
            }

            return Redirect(Request.UrlReferrer.AbsoluteUri);
        }
Exemple #3
0
 public static void UpdateFriendlyLinks()
 {
     FriendlyLinkService friendlyLinkService = new FriendlyLinkService();
     friendlyLinks = friendlyLinkService.GetFriendlyLinks();
 }
        public ActionResult Index()
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            FriendlyLinkModel model = new FriendlyLinkModel();

            FriendlyLinkService friendlyLinkService = new FriendlyLinkService();
            model.FriendlyLinks = friendlyLinkService.GetFriendlyLinks();

            return View(model);
        }