コード例 #1
0
        public ActionResult Performance(PerformanceLoggingView performanceLoggingView)
        {
            var referer = Request.UrlReferrer.AbsolutePath;

            performanceLoggingView.referer = referer;

            if (referer.StartsWith("/news/articleinfo/wxdetail/", StringComparison.OrdinalIgnoreCase))
            {
                // 添加代码处理articleinfo的数据
                performanceLoggingView.type = "News";
                int articleId   = int.Parse(referer.Substring(referer.LastIndexOf('/') + 1));
                var articleInfo = _articleInfoService.GetById <ArticleInfoView>(articleId);
                performanceLoggingView.title = articleInfo.ArticleTitle;
            }
            else if (referer.StartsWith("/message/wxdetail/", StringComparison.OrdinalIgnoreCase))
            {
                // 添加代码处理articleinfo的数据
                performanceLoggingView.type = "Message";
                int messageId = int.Parse(referer.Substring(referer.LastIndexOf('/') + 1));
                var message   = _messageService.GetList <MessageView>(t => t.Id == messageId).FirstOrDefault();
                performanceLoggingView.title = message.Title;
            }
            _objService.InsertView(performanceLoggingView);

            return(Json("ok"));
        }
コード例 #2
0
        public JsonResult GetItem(int id)
        {
            var item = _objServiceArticle.GetById <ArticleInfoView>(id);

            return(Json(item, JsonRequestBehavior.AllowGet));
        }