//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); }
//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); }