예제 #1
0
        public ResultToken SellStocks(int playerId, StockDetail stock, int quantity, decimal price)
        {
            ResultToken result = null;

            PlayerTransactionsDTO obj = new PlayerTransactionsDTO();

            obj.PlayerId = playerId;
            obj.Stock    = stock;
            obj.Quantity = quantity;
            obj.Price    = price;

            try
            {
                using (APIService apiClient = new APIService())
                {
                    var temp = apiClient.MakePostRequest("api/Broker/SellStocks", obj);
                    result = apiClient.ConvertObjectToToken(temp);
                    if (result != null && result.Success)
                    {
                        result.Data = obj;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger logger = LogManager.GetLogger("excpLogger");
                logger.Error(ex);
            }

            return(result);
        }
예제 #2
0
 public ResultToken SellStocks([FromBody] PlayerTransactionsDTO playerTrans)
 {
     using (PlayerService playerService = new PlayerService())
     {
         var result = playerService.sellStocks(playerTrans.PlayerId, playerTrans.Quantity, playerTrans.Stock, playerTrans.Price);
         return(result);
     }
 }