예제 #1
0
        /// <summary>
        /// 获取用于编辑景点的数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public AddOrEditViewSpotDto GetViewSpotForEdit(RTEntity <int> input)
        {
            if (input == null)
            {
                throw new RTException("输入参数不能为空");
            }
            var result = new AddOrEditViewSpotDto();

            using (var db = new RTDbContext())
            {
                var viewSpot = db.WisdomGuideViewSpots.FirstOrDefault(p => p.Id == input.Parameter);
                if (viewSpot == null)
                {
                    throw new RTException("所选数据不存在");
                }
                result.Id          = viewSpot.Id;
                result.SmallImgUrl = viewSpot.ImgUrl;
                //result.Content = viewSpot.Content;
                //result.ImgUrl = viewSpot.ImgUrl;
                //result.ViewSpotDescribe = viewSpot.ViewSpotDescribe;
                result.Position      = viewSpot.Position;
                result.Phone         = viewSpot.Phone;
                result.Longitude     = viewSpot.Longitude;
                result.Latitude      = viewSpot.Latitude;
                result.ViewSpotName  = viewSpot.ViewSpotName;
                result.WisdomGuideId = viewSpot.WisdomGuideId;

                var detail = _detail.GetDetail(new GetDetailInput
                {
                    ProjectId = viewSpot.Id
                }, db);
                if (detail == null)
                {
                    return(result);
                }

                result.BigImgUrl = detail.ImgUrl;
                result.Contents  = detail.Paragraphs;

                var videoList = db.WisdomGuideViewSpotVideos.Where(p => p.WisdomGuideViewSpotId == viewSpot.Id).ToList();
                if (videoList != null && videoList.Count != 0)
                {
                    result.VoiceList = new List <ViewSpotVideoDto>();
                    videoList.ForEach(item =>
                    {
                        result.VoiceList.Add(new ViewSpotVideoDto
                        {
                            ImgUrl                = item.ImgUrl,
                            VoiceName             = item.VoiceName,
                            VoiceUrl              = item.VoiceUrl,
                            WisdomGuideViewSpotId = item.WisdomGuideViewSpotId
                        });
                    });
                }
            }
            return(result);
        }
예제 #2
0
        /// <summary>
        /// 获取仁怀简介
        /// </summary>
        /// <returns></returns>
        public IntroduceInput Detail()
        {
            var result = new IntroduceInput();

            using (var db = new RTDbContext())
            {
                var data = db.Introduces.FirstOrDefault();
                if (data == null)
                {
                    throw new RTException("数据不存在,请联系管理员");
                }
                result.Title    = data.Title;
                result.VideoUrl = data.VideoUrl;
                //result.ImgUrl = data.ImgUrl;
                //result.Content = data.Content;

                var detail = _detail.GetDetail(new GetDetailInput
                {
                    ProjectId = data.Id
                }, db);
                if (detail == null)
                {
                    return(result);
                }

                result.BigImgUrl = detail.ImgUrl;
                result.Contents  = detail.Paragraphs;
            }
            return(result);
        }
        /// <summary>
        /// 根据Id获取单个旅游线路信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public TouristRouteForView GetTouristRoute(RTEntity <int> input)
        {
            var result = new TouristRouteForView();

            using (var db = new RTDbContext())
            {
                var route = db.TouristRoutes.FirstOrDefault(p => p.Id == input.Parameter);
                if (route == null)
                {
                    throw new RTException("所选数据不存在");
                }
                result.Id        = route.Id;
                result.ImgUrl    = route.ImgUrl;
                result.NeedDays  = route.NeedDays;
                result.RouteName = route.RouteName;

                var detail = _detail.GetDetail(new GetDetailInput
                {
                    ProjectId = route.Id
                }, db);
                if (detail == null)
                {
                    return(result);
                }
                result.Contents = detail.Paragraphs;
            }
            return(result);
        }
        /// <summary>
        /// 获取旅游信息用于编辑
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public AddOrEditTouristInformation GetInformationForEdit(RTEntity <int> input)
        {
            var result = new AddOrEditTouristInformation();

            using (var db = new RTDbContext())
            {
                var information = db.TouristInformations.FirstOrDefault(p => p.Id == input.Parameter);
                if (information == null)
                {
                    throw new RTException("所选数据不存在");
                }
                //result.Distance = information.Distance;
                result.Id          = information.Id;
                result.SmallImgUrl = information.ImgUrl;
                result.Position    = information.Position;
                result.Longitude   = information.Longitude;
                result.Latitude    = information.Latitude;
                result.Name        = information.Name;
                result.Phone       = information.Phone;
                result.Price       = information.Price;
                result.Type        = information.Type;
                if (result.Type == TouristInformationType.Hotel || information.Type == TouristInformationType.Winery)
                {
                    var detail = _detail.GetDetail(new GetDetailInput
                    {
                        Classify  = (int)result.Type,
                        ProjectId = information.Id
                    }, db);
                    if (detail == null)
                    {
                        return(result);
                    }

                    result.BigImgUrl = detail.ImgUrl;
                    result.Contents  = detail.Paragraphs;
                }
            }
            return(result);
        }