/// <summary> /// 添加文档 /// </summary> /// <param name="document"></param> /// <returns></returns> public DocumentObject Add(DocumentObject document) { _logger.Info("DocumentService 添加文档"); GeneratePreviewImage(document); document = _documentRepository.Add(document.ToEntity<Document>()).ToObject<DocumentObject>(); if (document != null) { _cacheService.Add(document); _bus.Send(new CreateDocumentMessage { Content = document }); } _logger.Debug("写入数据库成功"); return document; }
/// <summary> /// 更新某个文档 /// </summary> /// <param name="document"></param> /// <returns></returns> public DocumentObject Update(DocumentObject document) { _logger.Info("DocumentService 更新文档"); document = _documentRepository.Update(f => f.Id == document.Id,document.ToEntity<Document>()).ToObject<DocumentObject>(); if (document != null) { _cacheService.Update(document); _bus.Send(new UpdateDocumentMessage { Content = document }); } return document; }