public void AddApiSecret(ApiSecretDto apiSecretDto) { apiSecretDto.HashApiSharedSecret(); var transaction = this.Session.BeginTransaction(); try { var apiSecret = apiSecretDto.ToEntity(); this.Session.Save(apiSecret); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } }
public void UpdateApiSecret(int id, ApiSecretDto apiSecretDto) { apiSecretDto.HashApiSharedSecret(); var transaction = this.Session.BeginTransaction(); try { ApiSecret apiSecret = this.Session.Get <ApiSecret>(id); apiSecret = apiSecretDto.ToEntity(apiSecret); this.Session.Update(apiSecret); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } }