/// <summary>
 /// 转换为消息内容表实体
 /// </summary>
 /// <param name="dto">消息内容表数据传输对象</param>
 public static MessageContent ToEntity(this MessageContentDto dto)
 {
     if (dto == null)
     {
         return(new MessageContent());
     }
     return(dto.MapTo(new MessageContent(dto.Id.ToGuid())));
 }
        public ActionResult <ExpenseDto> ExtractExpense([FromBody] MessageContentDto messageContent)
        {
            if (messageContent == null)
            {
                throw new ArgumentNullException(nameof(messageContent));
            }

            try
            {
                Expense expense = _expenseService.Extract(messageContent.MessageContent);
                return(Ok(expense.ToDto()));
            }
            catch (XmlContentParserException exception)
            {
                _logger.Log("Failed to extract message content.", exception, messageContent);
                return(BadRequest(exception.Message));
            }
        }
 /// <summary>
 /// 转换为消息内容表实体
 /// </summary>
 /// <param name="dto">消息内容表数据传输对象</param>
 public static MessageContent ToEntity3(this MessageContentDto dto)
 {
     if (dto == null)
     {
         return(new MessageContent());
     }
     return(MessageContentFactory.Create(
                messageContentId: dto.Id.ToGuid(),
                categoryId: dto.CategoryId,
                title: dto.Title,
                senderId: dto.SenderId,
                sender: dto.Sender,
                sendTime: dto.SendTime,
                sourceId: dto.SourceId,
                content: dto.Content,
                url: dto.Url,
                state: dto.State,
                isDeleted: dto.IsDeleted,
                remark: dto.Remark,
                version: dto.Version
                ));
 }
 /// <summary>
 /// 转换为消息内容表实体
 /// </summary>
 /// <param name="dto">消息内容表数据传输对象</param>
 public static MessageContent ToEntity2(this MessageContentDto dto)
 {
     if (dto == null)
     {
         return(new MessageContent());
     }
     return(new MessageContent(dto.Id.ToGuid())
     {
         CategoryId = dto.CategoryId,
         Title = dto.Title,
         SenderId = dto.SenderId,
         Sender = dto.Sender,
         SendTime = dto.SendTime,
         SourceId = dto.SourceId,
         Content = dto.Content,
         Url = dto.Url,
         State = dto.State,
         IsDeleted = dto.IsDeleted,
         Remark = dto.Remark,
         Version = dto.Version,
     });
 }