예제 #1
0
        public IActionResult AddTag(int noteId, int tagId)
        {
            var createResponse = _noteService.AddTagNoteRelationship(noteId, tagId);

            if (createResponse.Success)
            {
                var note = _dbHelper.GetObjectByQuery <Notes, NoteDetail>(_noteService.GetNoteQuery(noteId));
                var tagNoteRelationshipsResponse = _dbHelper.GetObjectsByQuery <TagNoteRelationship, TagSummary>(_relationshipService.GetAllTagNotesByNoteId_Query(noteId));

                if (tagNoteRelationshipsResponse.Success)
                {
                    note.Data.Tags = tagNoteRelationshipsResponse.Data;
                }

                return(ApiResult(note));
            }

            return(ApiResult(createResponse));
        }