public void SaveDataFacade(mstCar data, IUnitofWork uow) { try { var repo = new mstCarRepository(uow); if (data.Name.Length > 5) { data.Name = "Panjang karakter lebih dari 5"; } else { data.Name = "Panjang karakter tidak lebih dari 5"; } repo.Add(data); } catch (Exception) { throw; } }
public void SaveData(mstCar data) { try { _uow.Open(DBConnection.BMIERP); _uow.BeginTransaction(); var repo = new mstCarRepository(_uow); repo.Add(data); _uow.CommitTransaction(); } catch (Exception) { _uow.RollbackTransaction(); throw; } finally { _uow.Dispose(); } }