Ejemplo n.º 1
0
        /// <summary>
        /// 添加未审核友情链接
        /// </summary>
        /// <param name="blog"></param>
        /// <returns></returns>
        public HandleResult <bool> AddFriendshipLink(BlogFriendshipLinkDto friendshipLinkDto)
        {
            var handleResult   = new HandleResult <bool>();
            var friendshipLink = Mapper.Map <BlogFriendshipLink>(friendshipLinkDto);
            int intcount       = _blogFriendshipLinkDAL.GetCount(t => t.FriendshipLinkUrl.Equals(friendshipLink.FriendshipLinkUrl) &&
                                                                 t.DeleteSign.Equals((int)DeleteSign.Sing_Deleted));

            if (intcount > 0)
            {
                handleResult.Msg    = "已经有该站点";
                handleResult.Result = false;
            }
            else
            {
                friendshipLink.CreateTime         = DateTime.Now;
                friendshipLink.EditTime           = DateTime.Now;
                friendshipLink.DeleteSign         = (int)DeleteSign.Sing_Deleted;
                friendshipLink.CreateUserId       = Guid.Empty.ToString();
                friendshipLink.FriendshipLinkSfsh = (int)Sfsh.Unreviewed;
                if (Add(friendshipLink))
                {
                    handleResult.Msg = "添加成功";
                }
                else
                {
                    handleResult.Msg    = "添加失败";
                    handleResult.Result = false;
                }
            }
            return(handleResult);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加友情链接
        /// </summary>
        /// <param name="blog"></param>
        /// <returns></returns>
        public IActionResult AddorUpdateFriendshipLink(BlogFriendshipLinkDto blog)
        {
            var resModel     = new ResponseModel();
            var handleResult = _blogFriendshipLinkBLL.AddorEditFriendshipLink(blog, _userAccount.GetUserInfo().UserId);

            resModel.RetCode = handleResult.Result ? StatesCode.success : StatesCode.failure;
            resModel.RetMsg  = handleResult.Msg;
            resModel.Data    = handleResult.Data;
            return(Ok(resModel));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加/编辑友情链接
        /// </summary>
        /// <param name="blog"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public HandleResult <bool> AddorEditFriendshipLink(BlogFriendshipLinkDto friendshipLinkDto, string userId)
        {
            var handleResult   = new HandleResult <bool>();
            var friendshipLink = Mapper.Map <BlogFriendshipLink>(friendshipLinkDto);

            //添加
            if (friendshipLink.FriendshipLinkId == 0)
            {
                int intcount = _blogFriendshipLinkDAL.GetCount(t => t.FriendshipLinkUrl.Equals(friendshipLink.FriendshipLinkUrl) &&
                                                               t.DeleteSign.Equals((int)DeleteSign.Sing_Deleted));
                if (intcount > 0)
                {
                    handleResult.Msg    = "已经有该站点";
                    handleResult.Result = false;
                }
                else
                {
                    friendshipLink.CreateTime         = DateTime.Now;
                    friendshipLink.EditTime           = DateTime.Now;
                    friendshipLink.DeleteSign         = (int)DeleteSign.Sing_Deleted;
                    friendshipLink.CreateUserId       = userId;
                    friendshipLink.FriendshipLinkSfsh = (int)Sfsh.Audited;
                    if (Add(friendshipLink))
                    {
                        handleResult.Msg = "添加成功";
                    }
                    else
                    {
                        handleResult.Msg    = "添加失败";
                        handleResult.Result = false;
                    }
                }
            }
            else//修改
            {
                var edit = GetModels(t => t.FriendshipLinkId == friendshipLinkDto.FriendshipLinkId).SingleOrDefault();
                edit.FriendshipLinkId    = friendshipLinkDto.FriendshipLinkId;
                edit.FriendshipLinkName  = friendshipLinkDto.FriendshipLinkName;
                edit.FriendshipLinkEmail = friendshipLinkDto.FriendshipLinkEmail;
                edit.FriendshipLinkUrl   = friendshipLinkDto.FriendshipLinkUrl;
                edit.Note     = friendshipLinkDto.Note;
                edit.EditTime = DateTime.Now;
                if (Update(edit))
                {
                    handleResult.Msg = "修改成功";
                }
                else
                {
                    handleResult.Msg = "修改失败";
                }
            }
            return(handleResult);
        }