/// <summary> /// GetContentComments /// </summary> /// <param name="contextId"></param> /// <returns></returns> public ContentCommentDataModel GetContentComments(ContextEnum context, int contextContentId) { ContentCommentDataModel contentCommentsData = null; ContentCommentRequestDC contentCommentsRequest = new ContentCommentRequestDC(); contentCommentsRequest.ContextId = (int)context; contentCommentsRequest.ContextContentId = contextContentId; ServiceResponse<ContentCommentDataDC> contentCommentsResponse = _contentProxy.Execute(opt => opt.GetContentComments(contentCommentsRequest)); if (contentCommentsResponse.Status == ResponseStatus.Success) { contentCommentsData=Mapper.Map<ContentCommentDataDC, ContentCommentDataModel>(contentCommentsResponse.Result); contentCommentsData.ContentComments = new List<ContentCommentModel>(); AddChildContentComments(contentCommentsData.ContentComments, contentCommentsResponse.Result.ContentComments, 0); } else { HandleError(contentCommentsResponse.Status, contentCommentsResponse.ResponseMessage); } return contentCommentsData; }
/// <summary> /// GetContentComments /// </summary> /// <param name="contentCommentsRequest"></param> /// <returns></returns> public ServiceResponse<ContentCommentDataDC> GetContentComments(ContentCommentRequestDC contentCommentsRequest) { ServiceResponse<ContentCommentDataDC> contentCommentsResponse = new ServiceResponse<ContentCommentDataDC>(); try { SetContext(); ContentCommentData contentCommentData = _contentManager.GetContentComments((ContextEnum)contentCommentsRequest.ContextId, contentCommentsRequest.ContextContentId); contentCommentsResponse.Result=Mapper.Map<ContentCommentData, ContentCommentDataDC>(contentCommentData); contentCommentsResponse.Result.ContentComments = new List<ContentCommentDC>(); contentCommentData.ContentComments.ForEach(result => { contentCommentsResponse.Result.ContentComments.Add(Mapper.Map<ContentComment, ContentCommentDC>(result)); }); } catch (Exception ex) { HandleError(ex, contentCommentsResponse); } return contentCommentsResponse; }