public BrokerBO AddBroker(BrokerBO broker) { broker _broker = new broker(); _broker.brokername = broker.BrokerName; if (broker.Address != null) { _broker.addrkey = broker.Address.AddrKey; } _broker.brokerid = broker.BrokerId; var brokerguid = repo.Add(_broker); broker.BrokerKey = brokerguid; return(broker); }
// Approve proposal (check risk, bank balance, etc) public async Task Handle(StockQuotationProposal arrivedProposal, CancellationToken cancellationToken) { if (arrivedProposal._ownerId != _id) { return; } // Instructions to approve proposal var stockQuotation = new StockQuotation(arrivedProposal); _newYorkStockExchange.Publish(stockQuotation).Wait(); if (!stockQuotation._isExecuted) { _brokerRepository.Add(stockQuotation); } }
// POST api/values public HttpResponseMessage Post([FromBody] BrokerBO brokerBO) { Data.broker _broker = new Data.broker(); _broker.brokerid = brokerBO.BrokerId; _broker.brokername = brokerBO.BrokerName; _broker.status = 1; _broker.statusdate = DateTime.Now; if (brokerBO.Address != null) { var custaddress = new Data.address() { address1 = brokerBO.Address.Address1, address2 = brokerBO.Address.Address2, city = brokerBO.Address.City, state = brokerBO.Address.State, country = brokerBO.Address.Country, zipcode = brokerBO.Address.Zip, email = brokerBO.Address.Email, fax = brokerBO.Address.Fax, addrname = _broker.brokerid }; var addrkey = new AddressRepository().Add(custaddress); _broker.addrkey = addrkey; } Guid brokerid = repo.Add(_broker); if (brokerid != null && brokerid != Guid.Empty) { return(Request.CreateResponse(HttpStatusCode.OK, brokerid, Configuration.Formatters.JsonFormatter)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public void Add(BrokerModel entity) { _repository.Add(entity); }