예제 #1
0
        public CommentResponse CreateComment(CommentRequest request)
        {
            List <DocumentSharingDTO> shared = default;
            List <string>             mylist = new List <string>();
            CommentResponse           retval = default;

            if (IsCommentAvailable(request))
            {
                retval = _DAL.CreateComment(request);
                shared = _documentSharingService.GetShareForDoc(new DocumentSharingRequestGetForDoc()
                {
                    DocID = _markersDAL.GetMarkerByID(new RequestGetMarkers()
                    {
                        DocID = request.commentDTO.MarkerID
                    }).Markers[0].DocID
                }).DocumentSharingDTO;
                if (shared != null)
                {
                    //create list type string for send to all
                    shared.ForEach(s => mylist.Add(s.UserId));
                    mylist.Remove(request.commentDTO.UserId);
                    _messanger.SendMarkerToAll(mylist, retval);
                }
            }
            return(retval);
        }