Exemplo n.º 1
0
        /// <summary>
        /// 更改已读未读状态
        /// </summary>
        /// <param name="myReadRecord"></param>
        /// <param name="workUser"></param>
        /// <returns></returns>
        public ReturnValueModel IsReadStatus(MyReadRecord myReadRecord, WorkUser workUser)
        {
            ReturnValueModel rvm = new ReturnValueModel();

            var mrr = _rep.FirstOrDefault <MyReadRecord>(s =>
                                                         s.DataInfoId == myReadRecord.DataInfoId && s.UnionId == workUser.WxUser.UnionId);

            if (mrr == null)
            {
                mrr            = myReadRecord;
                mrr.UnionId    = workUser.WxUser.UnionId;
                mrr.Id         = Guid.NewGuid().ToString();
                mrr.IsRead     = 1;
                mrr.CreateTime = DateTime.Now;
                mrr.CreateUser = workUser.WxUser.Id;
                _rep.Insert(mrr);
                _rep.SaveChanges();
                rvm.Success = true;
                rvm.Msg     = "";
                rvm.Result  = new
                {
                    mrr
                };
            }
            else
            {
                rvm.Success = true;
                rvm.Msg     = "";
                rvm.Result  = new
                {
                    mrr
                };
            }

            return(rvm);
        }
        public IHttpActionResult IsReadStatus(MyReadRecord myReadRecord)
        {
            var ret = _knowledgeService.IsReadStatus(myReadRecord, WorkUser);

            return(Ok(ret));
        }