Exemplo n.º 1
0
        public IActionResult AddTag(string TagName)
        {
            //添加新tag本身
            if (!service.CheckTagExist(TagName))
            {
                var tag = new Tag {
                    tag_name = TagName
                };

                context.Tag.Add(tag);
                context.SaveChanges();

                return(Ok(new
                {
                    Success = true,
                    msg = "Tag Added"
                }));
            }
            //tag已存在
            else
            {
                return(Ok(new
                {
                    Success = false,
                    msg = "Tag Existed"
                }));
            }
        }