mahao 1 year ago
parent
commit
0a12f4f4a9
  1. 31
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs

31
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization; using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Shouldly; using Shouldly;
using System; using System;
@ -76,10 +77,10 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
} }
/// <summary> /// <summary>
/// 新增实体 /// 添加
/// </summary> /// </summary>
[HttpPost] [HttpPost]
virtual public async Task<CentralizedControlDto> CreateAsync(CentralizedControlCreateDto input) public async Task<CentralizedControlDto> CreateAsync(CentralizedControlCreateDto input)
{ {
var _first = _repository.Where(p => p.Version == input.Version).FirstOrDefault(); var _first = _repository.Where(p => p.Version == input.Version).FirstOrDefault();
@ -103,6 +104,30 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
return dto; return dto;
} }
/// <summary>
/// 删除实体
/// </summary>
/// <param name="id">ID</param>
/// <returns>无</returns>
[HttpDelete]
public async Task DeleteAsync(Guid id)
{
var entity = await _repository.GetAsync(id);
await _repository.DeleteAsync(id);
}
/// <summary>
/// 按IDs删除实体列表
/// </summary>
[HttpPost]
public async Task<bool> DeleteListAsync(List<Guid> ids)
{
var _query = _repository.Where(p => ids.Contains(p.Id));
int i = await _query.BatchDeleteAsync();
return i == 0;
}
#endregion #endregion
#region 开启、关闭 #region 开启、关闭

Loading…
Cancel
Save