Exemple #1
0
        public ActionResult Show(string key)
        {
            var admin        = User.Identity.IsAuthenticated;
            var parsedSearch = _searchService.ParseKey(key);

            if (parsedSearch.Id > 0)
            {
                var result = _showAdvertService.GetAdvert(parsedSearch.AdType, parsedSearch.Id, admin);

                if (result.Success)
                {
                    if (((List <int>)Session["Visited"]).Find(x => x == Convert.ToInt32(key)) == 0)
                    {
                        ((List <int>)Session["Visited"]).Add(Convert.ToInt32(key));
                        _counterService.AddHit(key);
                    }
                    return(View(result.Data));
                }
                return(RedirectToAction("NotFound"));
            }

            return(RedirectToAction("NotFound"));
        }