Exemplo n.º 1
0
        public ActionResult AddTags(DocumentTags documentTags)
        {
            var userId = (this.HttpContext.Items["User"] as EntityUser).Id;

            this._documentService.TagDocument(documentTags, userId);
            return(Ok());
        }
Exemplo n.º 2
0
        public void TagDocument(DocumentTags documentTags, Guid userId)
        {
            foreach (string tag in documentTags.Tags)
            {
                EntityTag entityTag = new EntityTag
                {
                    Label      = tag,
                    UserId     = userId,
                    CreateDate = DateTime.Now,
                    DocumentId = documentTags.DocumentId
                };

                this._context.Tags.Add(entityTag);
            }
            this._context.SaveChanges();
        }