Exemple #1
0
        public ActionResult LinkEdit(LinkEditModel linkModel)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            T_FriendLink link;
            bool         result = false;

            if (linkModel.ID == 0)
            {
                link = new T_FriendLink()
                {
                    AddDate   = DateTime.Now,
                    AddUserID = user.UserId,
                    LinkMan   = linkModel.LinkMan,
                    LinkUrl   = linkModel.LinkUrl,
                    Name      = linkModel.SiteName,
                    State     = 1,
                    Remark    = linkModel.KeyWords
                };

                result = friendLinkLogic.AddFriendLink(link);
                return(RedirectToAction("Links"));
            }
            else
            {
                link         = friendLinkLogic.GetFriendLink(linkModel.ID);
                link.Name    = linkModel.SiteName;
                link.LinkUrl = linkModel.LinkUrl;
                link.Remark  = linkModel.KeyWords;
                link.LinkMan = linkModel.LinkMan;

                result = friendLinkLogic.UpdateFriendLink(link);
            }
            if (result)
            {
                WebCache.Remove(friendLinkLogic.FriendLinksKey);
                return(RedirectToAction("links"));
            }
            return(View());
        }
 public bool UpdateFriendLink(T_FriendLink link)
 {
     return(friendLinkData.Update(link));
 }
 public bool AddFriendLink(T_FriendLink link)
 {
     return(friendLinkData.Add(link) > 0);
 }