public int CreateBrokerageAccount(AddBrokerageAccountVm addBrokerageAccountVm) { var brokerageAccount = new BrokerageAccount { Title = addBrokerageAccountVm.Title, IsRetirement = addBrokerageAccountVm.IsRetirement, AccountNumber = addBrokerageAccountVm.AccountNumber, UserId = ActiveUserService.GetUserId(), BrokerageId = addBrokerageAccountVm.BrokerageId }; DbOperationStatus opStatus = BrokerageAccountRepository.InsertBrokerageAccount(brokerageAccount); if (opStatus.OperationSuccessStatus) { return opStatus.AffectedIndices.First(); } return -1; }
public bool UpdateBrokerageAccount(EditBrokerageAccountVm editBrokerageAccountVm, BrokerageAccount brokerageAccount) { if (editBrokerageAccountVm.UserId == brokerageAccount.UserId && editBrokerageAccountVm.Id == brokerageAccount.Id) { brokerageAccount.AccountNumber = editBrokerageAccountVm.AccountNumber; brokerageAccount.BrokerageId = editBrokerageAccountVm.BrokerageId; brokerageAccount.IsRetirement = editBrokerageAccountVm.IsRetirement; return BrokerageAccountRepository.UpdateBrokerageAccount(brokerageAccount).OperationSuccessStatus; } return false; }