public int CreateBusinessPartner(BusinessPartnerDto dto, int customerId) { BusinessPartner partner = new BusinessPartner(); UpdatePartner(dto, ref partner); var customer = _repository.Load<Customer>(customerId); using (TransactionScope scope = new TransactionScope()) { int returnVal =-1; try { customer.Partners.Add(partner); _repository.Save<BusinessPartner>(partner); _repository.Update<Customer>(customer); returnVal = partner.Id; scope.Complete(); } catch (Exception ex) { _log.Error("Error during creatin new Business Partner", ex); } return returnVal; } }
public void UpdatePartner(BusinessPartnerDto dto, ref BusinessPartner poco) { poco.Description = dto.Description; poco.Iban = dto.Iban; poco.Id = dto.Id; poco.Name = dto.Title; }