Beispiel #1
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <bool> SendMsgAsync(string authorization, MsgSendModel model)
        {
            var user = await GetUserAsync(authorization);

            if (user == null)
            {
                return(false);
            }
            return(await SendMsgAsync(user, model));
        }
Beispiel #2
0
        public async Task <bool> SendMsgAsync(EaUser user, MsgSendModel model)
        {
            var msg = await NonTrackingAsyncEnum.SingleOrDefault(s => s.Id == model.Mid);

            if (msg == null)
            {
                return(false);
            }
            _msgDetailRepository.DbSet.Add(new MsgDetail()
            {
                Content = model.Text,
                MsgId   = model.Mid,
                Cmds    = model.Cmd
            });
            var res = DbContext.SaveChanges();

            return(res > 0);
        }
        public async Task <IActionResult> SendMsg([FromForm] MsgSendModel model)
        {
            var res = await _msgRepository.SendMsgAsync(this.GetAuthorization(), model);

            return(Json(res));
        }