Exemplo n.º 1
0
        public ResponseInfoModel Getinfo(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var article = _articleService.GetInclude(id);
                var output  = article.MapTo <GetArticleOutput>();
                if (output != null)
                {
                    var content = _articleContentService.Get(a => a.ArticleID == id);
                    output.Content          = content == null ? "" : content.ArticleContents;
                    output.PictureAttach    = _articleAttachService.Get(a => a.ArticleGuid == output.Guid && a.ModuleType == 5).MapTo <GetObjAttachOutput>();
                    output.AttachLists      = _articleAttachService.GetNoTrackingList(a => a.ArticleGuid == output.Guid && a.ModuleType == 1).ToList().MapTo <List <GetArticleAttachOutput> >();
                    output.ArticleAuditList = _articleAuditLogService.GetArticleAuditLogs(id);
                }
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 2
0
        public ResponseInfoModel GetDetailInfo(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var wildlifeContent = _wildlifeContentService.Get(id);
                var output          = wildlifeContent.MapTo <GetWildlifeContentOutput>();
                if (output != null)
                {
                    output.Attachs = _articleAttachService.GetNoTrackingList(a => a.ModuleType == (int)AttachTypesEnum.动植物管理详细附件 && a.ArticleGuid == wildlifeContent.FileID).MapTo <List <GetObjAttachOutput> >();
                }
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifemanager/getdetailinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }