Exemplo n.º 1
0
        public ActionResult GetMsgContent(int id)
        {
            UserModel userModel = new UserModel();
            UserMessage msg = userModel.GetUserMessage(id);
            if (msg == null)
                return Json(new { key = 0, value = "该信息不存在!" }, JsonRequestBehavior.AllowGet);

            //如果该条信息没有被读过,则此时将其标记为已读
            if (!msg.Readed)
            {
                msg.Readed = true;
                userModel.Save();
            }
            return Json(new { key = 1, title = msg.MsgTitle, createTime = msg.CreateTime.ToString("yyyy/M/d HH:mm:ss"), content = msg.MsgContent }, JsonRequestBehavior.AllowGet);
        }