| | |
| | | [ApiDescriptionSettings(Name = "Delete"), HttpPost] |
| | | public async Task Delete(DeleteFBS_CusExtendInput input) |
| | | { |
| | | var entity = await _fBS_CusExtendRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002); |
| | | //await _fBS_CusExtendRep.FakeDeleteAsync(entity); //假删除 |
| | | await _fBS_CusExtendRep.DeleteAsync(entity); //真删除 |
| | | await _fBS_CusExtendRep.AsTenant().BeginTranAsync(); |
| | | try |
| | | { |
| | | var entity = await _fBS_CusExtendRep.AsQueryable().Includes(x => x.TransactionRole).Where(x => x.Id == input.Id).FirstAsync() ?? throw Oops.Oh(ErrorCodeEnum.D1002); |
| | | if (entity != null) |
| | | { |
| | | var exrles = await _fBS_CoutomerExRoleRep.GetFirstAsync(x => x.CustomerId == entity.CustomerId && x.ExRoleId == entity.TransactionRole.Id); |
| | | if (exrles != null) |
| | | { |
| | | await _fBS_CoutomerExRoleRep.DeleteAsync(exrles); |
| | | } |
| | | |
| | | //await _fBS_CusExtendRep.FakeDeleteAsync(entity); //假删除 |
| | | |
| | | await _fBS_CusExtendRep.DeleteAsync(entity); //真删除 |
| | | } |
| | | |
| | | await _fBS_CusExtendRep.AsTenant().CommitTranAsync(); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | await _fBS_CusExtendRep.AsTenant().RollbackTranAsync(); |
| | | throw; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |