示例#1
0
        // GET api/stocks/id
        public StockDTO GetById(int id)
        {
            Stock someStock = stockRepo.GetById(id);

            if (someStock == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            StockDTO someStockDTO = new StockDTO(someStock);

            return(someStockDTO);
        }
示例#2
0
        //public void AddStock(int id, Stock stock)
        public void AddStock(int id, int quantity)
        {
            Stock stock = stockInterface.GetById(id);

            if ((quantity <= 0) && (stock == null))
            {
                throw new Exception();
            }

            stock.AvailableQty += (Int16)quantity;

            stockInterface.Update(stock);
        }