예제 #1
0
        /// <summary>
        /// Save GlobleNote
        /// </summary>
        public string SaveGlobleNote(Section section, long[] docIdArray, string userUuid, long parentId)
        {
            List <GlobleNote> GlobleNoteList = new List <GlobleNote>();

            GlobleNoteList = docIdArray.ToList().Select(d => new GlobleNote
            {
                GlobleNoteId = 0,
                DocumentId   = d,
                ParentId     = parentId,
                SectionId    = (int)section,
            }).ToList();

            var globleNotepast = _globleNoteRepo.RetriveGlobleNote((int)section, parentId);

            if (globleNotepast.Count() > 0)
            {
                string error = _globleNoteRepo.DeleteGlobleNote(globleNotepast.Select(d => d.GlobleNoteId).ToArray());
                if (error != null)
                {
                    return(error);
                }
                error = _documentDbRepo.DeleteDocument(globleNotepast.Select(d => d.DocumentId).ToArray());
                if (error != null)
                {
                    return(error);
                }
            }

            return(_globleNoteRepo.SaveGlobleNote(GlobleNoteList, userUuid));
        }