public string AddTagToThread(string id, [FromBody] string value)
        {
            _threadRepository.Change(id, (model) => {
                if (model != null && !model.Tags
                    .Select(m => m.Name.ToLower())
                    .Contains(value.ToLower()))
                {
                    var newTag = _tagRepository.CreateTagIfNotExists(value);

                    model.Tags.Add(newTag);
                }
            });

            return(value);
        }
Exemple #2
0
        // POST: api/Tag
        public Tag Post([FromBody] string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(null);
            }

            return(_tagRepositry.CreateTagIfNotExists(value));
        }