Ejemplo n.º 1
0
        public void RemoveProduct()
        {
            ProductsData controller = new ProductsData();

            List <WarehouseModel> warehouseList = new List <WarehouseModel>();

            warehouseList.Add(new WarehouseModel("SP", 5, "WEB"));
            warehouseList.Add(new WarehouseModel("SP", 5, "WEB"));
            controller.Add(new ProductModel(6, "teste", new InventoryModel(warehouseList)));
            controller.RemoveProduct(6);

            ProductModel result = controller.GetProductBySKU(6);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Delete(int sku)
        {
            try
            {
                productData.RemoveProduct(sku);

                return(Request.CreateResponse(HttpStatusCode.OK, string.Format("Produto {0} deletado", sku)));
            }
            catch (NotFoundException nf)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, nf.Message));
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message));
            }
        }