...
This commit is contained in:
@@ -134,6 +134,36 @@ namespace Back.Data.Infrastructure.Repository
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<T?> UpdateByObjAsync(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_dbContext.Entry(entity).State = EntityState.Modified;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public T? UpdateByObj(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_dbContext.Update(entity);
|
||||
var result = _dbContext.SaveChanges();
|
||||
return entity;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> DeleteAsync(T entity)
|
||||
{
|
||||
|
Reference in New Issue
Block a user