|
|
@ -4,6 +4,7 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Domain.Services; |
|
|
|
using Volo.Abp.EventBus.Distributed; |
|
|
|
using Volo.Abp.EventBus.Local; |
|
|
@ -145,4 +146,22 @@ public abstract class SfsStoreManagerBase<TEntity, TDetailEntity> |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<TEntity> InsertOrUpdateAsync(TEntity entity) |
|
|
|
{ |
|
|
|
var isExist = await Repository.AnyAsync(p => p.Id == entity.Id).ConfigureAwait(false); |
|
|
|
if (!isExist) |
|
|
|
{ |
|
|
|
return await Repository.InsertAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return await Repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<TEntity> UpdateAsync(TEntity entity) |
|
|
|
{ |
|
|
|
return await Repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|