Compare commits
No commits in common. "1fad2c513c941d051469c6e164bdd27ef7b8c218" and "affc336f7d177a70e070dc92939bbb19ddc9eba8" have entirely different histories.
1fad2c513c
...
affc336f7d
|
|
@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Application.Contracts;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
|
@ -100,36 +99,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
//---读取模板内容失败, 请将文件另存为docx格式尝试!
|
||||
return ResponseOutput.NotOk(_localizer["Document_ TemplateRead"]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (addOrEditCommonDocument.Id == null) //insert
|
||||
{
|
||||
var entity = await _commonDocumentRepository.InsertOrUpdateAsync(addOrEditCommonDocument, true, verifyExp1, verifyExp2);
|
||||
|
||||
|
||||
var entity = await _commonDocumentRepository.InsertFromDTOAsync(addOrEditCommonDocument, true, verifyExp1, verifyExp2);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
else //update
|
||||
{
|
||||
|
||||
var dbbeforeEntity = await _commonDocumentRepository.UpdateFromDTOAsync(addOrEditCommonDocument, false, false, verifyExp1, verifyExp2);
|
||||
|
||||
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, dbbeforeEntity.Path);
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -137,20 +114,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpDelete("{commonDocumentId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteCommonDocument(Guid commonDocumentId)
|
||||
{
|
||||
var find= await _commonDocumentRepository.FirstOrDefaultNoTrackingAsync(t=>t.Id== commonDocumentId);
|
||||
|
||||
var success = await _commonDocumentRepository.DeleteFromQueryAsync(t => t.Id == commonDocumentId, true,true);
|
||||
|
||||
if (find != null)
|
||||
{
|
||||
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, find.Path);
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue