Ejemplo n.º 1
0
 public JsonResult DeleteTextReply(TextReplyItem reply)
 {
     svc.Delete(reply);
     return(new JsonResult()
     {
         JsonRequestBehavior = JsonRequestBehavior.AllowGet,
         Data = new { success = true }
     });
 }
Ejemplo n.º 2
0
        public ActionResult AddTextReply(TextReplyItem textreply)
        {
            svc.Create(textreply);
            ViewBag.RuleID = textreply.RuleID;
            var Textreplys = svc.Select(new TextReplyItemQuery()
            {
                OwnerID = 1, RuleID = textreply.RuleID
            });

            return(PartialView("Conversation/TextReply", Textreplys));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 被关注自动回复
        /// 不存在,则补充完备数据,保证进入页面时,数据是完备的
        /// </summary>
        /// <returns></returns>
        public ActionResult FollowedIndex()
        {
            //获取KeyWordGroup信息
            var _KeyWordGroup = svc.Select(
                new RuleQuery()
            {
                OwnerID = OwnerID,
                Type    = (int)RuleType.Subscribe
            }).FirstOrDefault();

            // 不存在,则写入新纪录
            if (_KeyWordGroup == null)
            {
                Rule _Model = new Rule();
                _Model.Name    = "被关注自动回复";
                _Model.OwnerID = OwnerID;
                _Model.Type    = (int)RuleType.Subscribe;

                //插入KeyWordGroup
                svc.Create(_Model);

                //获取新插入的KeyWordGroup记录
                _KeyWordGroup = _Model;
            }

            //获取Reply信息
            var _Reply = svc.Select(
                new ReplyQuery()
            {
                OwnerID = OwnerID,
                Type    = (int)ReplyType.Text,
                RuleID  = _KeyWordGroup.ID
            }).FirstOrDefault();

            //不存在,则写入一条新纪录
            if (_Reply == null)
            {
                Reply _ReplyModel = new Reply();
                _ReplyModel.OwnerID = OwnerID;
                _ReplyModel.Type    = (int)ReplyType.Text;
                _ReplyModel.RuleID  = _KeyWordGroup.ID;

                svc.Create(_ReplyModel);

                _Reply = _ReplyModel;
            }

            //获取TextReply信息
            var _TextReplyItem = svc.Select(
                new TextReplyItemQuery()
            {
                RuleID   = _KeyWordGroup.ID,
                ParentID = _Reply.ID,
                OwnerID  = OwnerID
            }).FirstOrDefault();

            //不存在,则写入新纪录
            if (_TextReplyItem == null)
            {
                TextReplyItem _TextReplyItemModel = new TextReplyItem();
                _TextReplyItemModel.RuleID   = _KeyWordGroup.ID;
                _TextReplyItemModel.ParentID = _Reply.ID;
                _TextReplyItemModel.OwnerID  = OwnerID;
                _TextReplyItemModel.Content  = "";

                svc.Create(_TextReplyItemModel);

                _TextReplyItem = _TextReplyItemModel;
            }

            return(View(_TextReplyItem));
        }