57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
//--------------------------------------------------------------------
|
|
// 此代码由T4模板自动生成 byzhouhang 20210918
|
|
// 生成时间 2022-03-31 13:18:56
|
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
|
//--------------------------------------------------------------------
|
|
|
|
using IRaCIS.Core.Domain.Models;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using IRaCIS.Core.Application.Interfaces;
|
|
using IRaCIS.Core.Application.ViewModel;
|
|
namespace IRaCIS.Core.Application.Service
|
|
{
|
|
/// <summary>
|
|
/// CommonDocumentService
|
|
/// </summary>
|
|
[ApiExplorerSettings(GroupName = "Common")]
|
|
public class CommonDocumentService : BaseService, ICommonDocumentService
|
|
{
|
|
|
|
private readonly IRepository<CommonDocument> _commonDocumentRepository;
|
|
|
|
public CommonDocumentService(IRepository<CommonDocument> commonDocumentRepository)
|
|
{
|
|
_commonDocumentRepository = commonDocumentRepository;
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<List<CommonDocumentView>> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument)
|
|
{
|
|
|
|
var commonDocumentQueryable = _commonDocumentRepository.ProjectTo<CommonDocumentView>(_mapper.ConfigurationProvider);
|
|
|
|
return await commonDocumentQueryable.ToListAsync();
|
|
}
|
|
|
|
|
|
public async Task<IResponseOutput> AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument)
|
|
{
|
|
var verifyExp1 = new EntityVerifyExp<CommonDocument>()
|
|
{
|
|
VerifyExp = t => t.Code == addOrEditCommonDocument.Code,
|
|
VerifyMsg = "Document Code Can not Repeat."
|
|
};
|
|
|
|
var entity = await _commonDocumentRepository.InsertOrUpdateAsync(addOrEditCommonDocument, true, verifyExp1);
|
|
|
|
return ResponseOutput.Ok(entity.Id.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|