Exemplo n.º 1
0
        /* This action method takes the result object from the view when any result is clicked, it check with the database if the result already exists, if yes it increases
         * the click counter. If no it adds a new record to the database.*/
        public ActionResult UpdateAndRedirect(SearchResultDTO x)
        {
            var bll          = new Bll.Bll();
            var searchReturn = bll.GetSearchCount(x.TrackId);

            if (searchReturn != null)
            {
                bll.UpdateCounter(searchReturn.Id, searchReturn.ClickCount);
            }
            else
            {
                string ip        = Request.UserHostAddress;
                string useragent = Request.Browser.Type;
                x.UserIP    = ip;
                x.UserAgent = useragent;
                bll.AddSearchResult(x);
            }
            return(Json(new { Success = true, ErrorMessage = "Done" }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /* This controller action method gets the click count data from the database. It returns top 25 records ordered by click count */
        public ActionResult ViewClickCount()
        {
            var bll = new Bll.Bll();

            return(View(bll.GetClickData()));
        }