示例#1
0
        /// <summary>
        /// 更新标签
        /// </summary>
        /// <param name="updatemodel"></param>
        /// <returns></returns>
        public string UpdateTag(TagModel updatemodel)
        {
            if (updatemodel.TagID <= 0)
            {
                return("ID为空");
            }

            var tagdal = new TagDal();
            var model  = tagdal.GetFirst(x => x.TagID == updatemodel.TagID);

            if (model == null)
            {
                return("数据不存在");
            }

            model.TagName = updatemodel.TagName;
            model.TagDesc = updatemodel.TagDesc;
            model.TagLink = updatemodel.TagLink;

            if (tagdal.Exist(x => x.TagName == model.TagName && x.TagID != model.TagID))
            {
                return("存在同名标签");
            }

            return(tagdal.Update(model) > 0 ? SUCCESS : "添加失败");
        }
示例#2
0
        public string DeleteTag(string id)
        {
            var tagdal = new TagDal();
            var model  = tagdal.GetFirst(x => x.UID == id);

            if (model == null)
            {
                return("数据不存在");
            }
            return(tagdal.Delete(model) > 0 ? SUCCESS : "删除失败");
        }
示例#3
0
        public string DeleteTag(int id)
        {
            if (id <= 0)
            {
                return("ID为空");
            }
            var tagdal = new TagDal();
            var model  = tagdal.GetFirst(x => x.TagID == id);

            if (model == null)
            {
                return("数据不存在");
            }
            return(tagdal.Delete(model) > 0 ? SUCCESS : "删除失败");
        }
示例#4
0
        /// <summary>
        /// 通过id获取标签
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public TagModel GetTagByID(string id)
        {
            var tagdal = new TagDal();

            return(tagdal.GetFirst(x => x.UID == id));
        }