示例#1
0
 public ChatRecordContentVM(ChatRecordContent bo)
 {
     this.SetVM <ChatRecordContent>(bo);
     this.AscriptionUserId = bo.AscriptionUserId;
     this.SenderId         = bo.SenderId;
     this.ReceiverId       = bo.ReceiverId;
     this.Message          = bo.Message;
 }
示例#2
0
 /// <summary>
 /// 保存聊天记录到数据库
 /// </summary>
 /// <param name="record"></param>
 /// <returns></returns>
 public async Task AddChatRecordContent(ChatRecordContentInput input)
 {
     var thisUserId = GetThisUserId;
     var chatRecord = _chatRecordRepository.GetAll()
                      .FirstOrDefault(x => x.SenderId == GetThisUserId && x.ReceiverId == input.ReceiverId || x.SenderId == input.ReceiverId && x.ReceiverId == thisUserId);
     var chatRecordContent = new ChatRecordContent
     {
         ChatRecordId     = chatRecord.Id,
         AscriptionUserId = thisUserId,
         SenderId         = thisUserId,
         ReceiverId       = input.ReceiverId,
         Message          = input.Message
     };
     await _chatRecordContentRepository.AddOrEditAndSaveAsyn(chatRecordContent);
 }