Exemple #1
0
        public ActionResult Noticia(Int32 id, String social, Int32?idInfluencer)
        {
            var IP = Request.UserHostAddress;

            SetCookie("VisitCookie", IP, true);
            var date = DateTime.Now;

            var label = "Público";

            if (idInfluencer.HasValue)
            {
                InfluencerService.CreateVisit(id, idInfluencer, IP, date, social, Request.Cookies["VisitCookie"].Value);
            }
            else
            if (!Request.Browser.Crawler && !Request.UserHostAddress.Contains("127.0.0"))
            {
                InfluencerService.CreateVisit(id, null, IP, date, label, Request.Cookies["VisitCookie"].Value);
            }

            var noticia = MagazineService.GetNewsById(id);
            var model   = new NoticiasViewModel
            {
                Noticia = noticia,
            };
            var idCategory = noticia.CategoryId;

            if (UserService.GetCurrentUser() != null)
            {
                ViewBag.userEmail = UserService.GetCurrentUser().Email.ToString();
            }

            ViewBag.todaysDate = DateTime.Now.ToLongDateString();
            ViewBag.Cat        = MagazineService.GetLastNewsesByCategoryId(idCategory, id);

            return(View(model));
        }