Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public static void UpdateFriendlyLinks()
 {
     FriendlyLinkService friendlyLinkService = new FriendlyLinkService();
     friendlyLinks = friendlyLinkService.GetFriendlyLinks();
 }
Example #4
0
        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);
        }