예제 #1
0
        public HttpResponseMessage Post([FromBody] TransactionHistoryInfo transactionInfo)
        {
            if (transactionInfo == null)
            {
                return(Request.CreateResponse(new ArgumentException($"Transaction information is empty")));
            }
            var sharesService = clientsSharesService.GetAllClientsShares().Where(
                x => x.ClientID == transactionInfo.SellerClientID && x.ShareID == transactionInfo.ShareID).FirstOrDefault();

            if (sharesService == null)
            {
                return(Request.CreateResponse(new ArgumentException($"Combination of client {transactionInfo.SellerClientID} and {transactionInfo.ShareID} not exist")));
            }
            tradingOperationService.SellAndBuyShares(transactionInfo.BuyerClientID, transactionInfo.SellerClientID, sharesService, transactionInfo.Amount);
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
예제 #2
0
 public IQueryable <ClientsSharesEntity> Get()
 {
     return(shareService.GetAllClientsShares());
 }