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 bool UpdateBusinessPartner(BusinessPartnerDto partner, int customerId) { Contract.Requires<BusinessPartnersServicesException>(partner != null); return default(bool); }
public void UpdatePartner(BusinessPartnerDto dto, ref BusinessPartner poco) { poco.Description = dto.Description; poco.Iban = dto.Iban; poco.Id = dto.Id; poco.Name = dto.Title; }
public bool UpdateBusinessPartner(BusinessPartnerDto dto, int customerId) { BusinessPartner partner = _repository.Load<BusinessPartner>(dto.Id); UpdatePartner(dto, ref partner); bool returnVal = false; using (TransactionScope scope = new TransactionScope()) { try { _repository.Update<BusinessPartner>(partner); _repository.Flush(); returnVal = true; scope.Complete(); } catch (Exception ex) { _log.Error("Error during updating business partner", ex); } } return returnVal; }