Пример #1
0
        public IHttpActionResult GetArticle(int id)
        {
            ArticleDetailDto article = _articleAppService.Find(id);

            if (article == null)
            {
                return(NotFound());
            }

            return(Ok(article));
        }
Пример #2
0
        private async Task SetData()
        {
            _article = await ArticleService.QueryArticleDetail(new ArticleDetailQueryParam
            {
                Slug     = Slug,
                UserName = Username
            });

            if (_article != null)
            {
                _comments = (await CommentService.QueryListAsync(new CommentQuery
                {
                    ContentId = _article.ContentId
                })).Items.ToList();
            }
        }
Пример #3
0
 public ArticleAddedIntegrationEvent(ArticleDetailDto dto)
 {
     ArticleDto = dto;
 }
Пример #4
0
 public ArticleEditViewModel(ArticleDetailDto article)
 {
     this.Article = article;
     this.TagIds  = new List <int>();
 }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PicModel"/> class.
        /// 景区Id号,和游记攻略Id号
        /// </summary>
        /// <param name="sightId">The sight id.</param>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public ArticleDetailDto GetArticleDetailModel(int?sightId, int?id)
        {
            ArticleDetailDto data = new ArticleDetailDto();

            data.ArticleInfo = GetArticleSingleById(id);
            if (data.ArticleInfo != null)
            {
                data.ArticleInfo.VisitCount += 1;
                try
                {
                    articleInfoRepository.Uow.Commit();
                }
                catch
                {
                }
                data.ArticleType = GetArticleClassById(data.ArticleInfo.ClassID);
                var sightDto = sightInfoService.GetSightSingleById(sightId);

                //var sightDto = AutoMapper.Mapper.Map<iPow.Infrastructure.Data.DataSys.Sys_SightInfo
                //    ,iPow.Domain.Dto.Sys_SightInfoDto>(sight);

                data.SightInfo = sightDto;
                if (data.SightInfo != null)
                {
                    data.SightClass = sightInfoService.GetSightClassById(data.SightInfo.ClassID);

                    #region sight cir

                    var sightCir = data.SightInfo.CirParkID;
                    if (sightCir != null)
                    {
                        sightCir = (sightCir.Length > 1 && (sightCir.LastIndexOf(',') == 0)) ? sightCir.Substring(0, sightCir.Length - 1) : sightCir;
                        string[]   cirStrArray = sightCir.Split(',');
                        List <int> cirList     = new List <int>();
                        for (int i = 0; i < cirStrArray.Length; i++)
                        {
                            int temp = 0;
                            int.TryParse(cirStrArray[i], out temp);
                            if (temp != 0)
                            {
                                cirList.Add(temp);
                            }
                        }
                        data.CirSightInfoList = sightInfoService.GetCirSightListBySight(data.SightInfo, 9);
                    }
                    if (data.CirSightInfoList == null)
                    {
                        data.CirSightInfoList = new List <iPow.Domain.Dto.Sys_SightInfoDto>();
                    }
                    data.CirSightInfoList.Insert(0, data.SightInfo);
                    #endregion

                    #region hotel cir

                    //新版的酒店,数据写在页面上,所以不要这个字段了
                    //edited by yjihrp 2011.11.25.14.54
                    //var hotelCir = data.SightInfo.CirHotelID;
                    //if (hotelCir != null)
                    //{
                    //    hotelCir = (hotelCir.Length > 1 && (hotelCir.LastIndexOf(',') == 0)) ? hotelCir.Substring(0, hotelCir.Length - 1) : hotelCir;
                    //    string[] cirStrArray = hotelCir.Split(',');
                    //    List<int?> cirList = new List<int?>();
                    //    for (int i = 0; i < cirStrArray.Length; i++)
                    //    {
                    //        int temp = 0;
                    //        int.TryParse(cirStrArray[i], out temp);
                    //        if (temp != 0)
                    //        { cirList.Add(temp); }
                    //    }
                    //    data.CirHotelInfoList = Bll.SightInfo.GetCirHotelListBySight(data.SightInfo, 10);
                    //}
                    //end edited by yjihrp 2011.11.25.14.54
                    #endregion
                }
            }
            return(data);
        }