Exemple #1
0
        public async Task <IActionResult> InsertTag(TagInsertModel tagModel)
        {
            //string tag;
            //var insertValue = mapper.Map<Tag>(tagModel);
            if (tagModel != null)
            {
                for (int i = 0; i < tagModel.tags.Count; i++)
                {
                    // tag = tagModel.tags[i];
                    Tag tagToInsert = new Tag()
                    {
                        NoteId    = tagModel.NoteId,
                        Tags      = tagModel.tags[i],
                        OnCreated = DateTime.Now
                    };
                    //await tagManager.Insert(insertValue);
                    await tagManager.Insert(tagToInsert);
                }

                return(Ok(200));
            }


            return(StatusCode(400));
        }
        private async void submitButton_Click(object sender, EventArgs e)
        {
            TagInsertModel tag = new TagInsertModel();

            tag.Title = txtTitle.Text;
            await _tagService.Post <dynamic>(tag);

            Close();
        }
        public IActionResult Insert(TagInsertModel tagModel)
        {
            var exists = _tagService.Get(new TagSearchRequest
            {
                Title = tagModel.Title
            }).FirstOrDefault();

            if (exists == null)
            {
                _tagService.Insert(tagModel);
            }
            return(Ok());
        }