This commit is contained in:
mmrbnjd
2024-04-17 15:49:34 +03:30
parent f829d80851
commit 3f0a37a08b
27 changed files with 1253 additions and 79 deletions

View File

@@ -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)
{