예제 #1
0
        public IHttpActionResult GetParkByParkName(string parkName)
        {
            ParkModel park = parkDAL.GetParkByParkName(parkName);

            park.Trails = trailDAL.GetTrailsByParkName(parkName);
            park.UserVisitedPanoramics = new List <PanoramicModel>();
            park.Trails.ForEach(
                trail =>
            {
                trail.TrailHead         = panoramicDAL.GetTrailHeadByTrailId(trail.TrailId);
                trail.PointsOfInterest  = panoramicDAL.GetPointsOfInterestByTrailId(trail.TrailId);
                trail.PanoramicsInTrail = panoramicDAL.GetPanoramicsByTrailId(trail.TrailId);
                trail.PanoramicsInTrail.ForEach(
                    panoramic => panoramic.Connections = panoramicDAL.GetConnectionsByPanoramicId(panoramic.PanoramicId)
                    );

                if (User.Identity.IsAuthenticated)
                {
                    park.UserVisitedPanoramics.AddRange(panoramicDAL.GetVisitedPanoramicsByUsername(User.Identity.Name));
                }
            }
                );


            return(Ok(park));
        }
예제 #2
0
        public ActionResult ChooseTrail(string id)
        {
            ParkModel park = parkDAL.GetParkByParkName(id);

            park.Trails = trailDAL.GetTrailsByParkName(id);
            park.Trails.ForEach(trail => trail.Image = trailDAL.GetImageByTrailId(trail.TrailId));

            return(View("ChooseTrail", park));
        }