예제 #1
0
        public ActionResult Details(string url)
        {
            var modelDb = _context.GetPlaceDetails(url);

            if (modelDb == null)
            {
                return(RedirectToAction("Index"));
            }
            var model = Mapper.Map <PlaceDetailsVm>(modelDb);

            model.GroupTitle    = _context.GetGroupTitleByTypeId(model.PlaceTypeId);
            model.PlaceEvents   = Mapper.Map <List <EventBaseVm> >(_context.GetPlaceEvent(model.PlaceId));
            model.OtherPlaces   = Mapper.Map <List <PlaceBaseVm> >(_context.GetOtherPlaces(model.PlaceId, model.PlaceTypeId));
            model.GroupUrl      = _context.GetGroupUrlByTypeId(model.PlaceTypeId);
            model.TypeUrl       = _context.GetTypeUrlByTypeId(model.PlaceTypeId);
            ViewBag.Keywords    = string.Format("{0},{1}", model.TypeTitleOne, model.GroupTitle);
            ViewBag.Description = model.ShortInfoCutted(150);
            if (Request.Url != null)
            {
                ViewBag.OgImage = string.Format("{0}{1}",
                                                Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, string.Empty), model.PosterSmallUrl);
            }
            return(View(model));
        }