public void AddLogToDb(Log log) { DbContext.Add(log); try { DbContext.SaveChanges(); } catch (DbUpdateException exception) { if (exception.InnerException != null) { throw exception.InnerException; } throw; } }
public async Task <TEntity> CreateAsync(TEntity entity) { DbContext.Add(entity); try { await DbContext.SaveChangesAsync(); } catch (DbUpdateException exception) { if (exception.InnerException != null) { throw exception.InnerException; } throw; } return(entity); }