public void DeleteGroceryItem([FromBody] GroceryItem ApiRequest)
        {
            // Null or Empty checks
            ApiRequest = ApiRequest ?? throw new NullReferenceException("Item Object is null");

            if (ApiRequest.quantity != 0)
            {
                // Removes a specific quantity of an item
                _groceryService.DeleteGroceryItem(ApiRequest);
            }
            else
            {
                // Removes entire item and its quantity from the list
                _groceryService.DeleteGroceryItem(ApiRequest.name);
            }
        }
Example #2
0
 public void DeleteGroceryItem(string item)
 {
     _groceryRepository.DeleteGroceryItem(item);
 }