Пример #1
0
        public ResponseInfoModel GetInfo(int ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var category = _articleCategoryService.Get(a => a.ID == ID);
                var output   = category.MapTo <GetCategoryOutput>();

                if (output != null)
                {
                    var parent = _articleCategoryService.Get(a => a.ID == output.ParentID);
                    output.ParentName = parent == null ? "" : parent.Name;

                    var attach = _articleAttachService.Get(a => a.ArticleGuid == category.Guid);
                    output.Attach = attach.MapTo <GetObjAttachOutput>();
                }
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/getInfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Пример #2
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);
        }
Пример #3
0
        public ResponseInfoModel ViewInfo(int ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var viewSpot = _viewSpotService.Get(ID);
                var output   = viewSpot.MapTo <GetViewSpotInfoOutput>();
                if (output != null)
                {
                    var attach = _articleAttachService.Get(a => a.ModuleType == (int)AttachTypesEnum.景点附件 && a.ArticleGuid == viewSpot.FileID);
                    output.AttachUrl = attach == null ? "" :GetPublishUrl() + attach.AttachUrl;
                    json.Result      = output;
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/viewspot/viewlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Пример #4
0
        public ResponseInfoModel Getinfo(int ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var template = _templateService.Get(ID);
                var attach   = _articleAttachService.Get(a => a.ArticleGuid == template.Guid);
                var output   = template.MapTo <GetTemplateOutput>();
                output.Attach = attach.MapTo <GetTemplateAttachOutput>();
                json.Result   = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/template/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Пример #5
0
        public ResponseInfoModel GetInfo(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var wildlifeManager = _wildlifeManagerService.Get(id);
                var output          = wildlifeManager.MapTo <GetWildlifeManagementOutput>();
                if (output != null)
                {
                    output.Attach = _articleAttachService.Get(a => a.ModuleType == (int)AttachTypesEnum.动植物管理附件 && a.ArticleGuid == wildlifeManager.FileID).MapTo <GetObjAttachOutput>();
                }
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifemanager/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Пример #6
0
        public ResponseInfoModel GetcontentInfo(int ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var content = _PublicityContentService.Get(ID);
                var output  = content.MapTo <GetPublicityContentOutput>();
                if (output != null)
                {
                    output.Attach = _articleAttachService.Get(a => a.ArticleGuid == content.AttachGuid && a.ModuleType == 2).MapTo <GetObjAttachOutput>();
                }
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/getcontentInfo", LocalizationConst.QueryFail);
            }
            return(json);
        }