Esempio n. 1
0
        //PUT api/stocks
        public StockDTO Put(StockDTO stock)
        {
            //Need to have error handling!
            Stock stockToGet    = stockRepo.GetById(stock.StockReferenceID);
            var   stockToUpdate = updateStock(stock, stockToGet);

            stockRepo.Update(stockToUpdate);
            return(stock);
        }
Esempio n. 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);
        }