public bool Remove(int id) { if (id <= 0) { return(false); } using (var con = _db.GetConnection()) { Organization org = con.Get <Organization>(id); if (org == null) { return(false); } using (var tran = con.BeginTransaction()) { _addressRepository.Remove(org.AddressId, con, tran); _contactRepository.Remove(org.ContactId, con, tran); bool success = con.Delete(org, tran); tran.Commit(); return(success); } } }
public virtual bool Remove(int ledgerId, IDbConnection con, IDbTransaction tran) { if (ledgerId <= 0) { return(false); } TEntity entity = con.Select <TEntity>(b => b.LedgerId == ledgerId, tran) .FirstOrDefault(); if (entity == null) { return(true); } _addressRepository.Remove(entity.AddressId, con, tran); _contactRepository.Remove(entity.ContactId, con, tran); return(con.Delete(entity, tran)); }