1

I have a many-to-many relationship between Ticket and ProductList . Here's is what I have for a Ticket :

// INIT MODEL
                    var ticketModel = new Ticket
                    {
                        Customer = new Customer(),
                        Seller = new Seller(),
                        AddressInvoice = new Address(),
                        ProductList = new List<Product>()
                    };
                    JsonPatchDocument model = new JsonPatchDocument();

                    // FOR EACH COLUMN
                    foreach (var map in mapList)
                    {
                        if (map.FieldName.Contains("List"))
                            model.Add(map.FieldName, fields[map.ColumnIndex]);
                        else
                            model.Add(map.FieldName, fields[map.ColumnIndex]);
                    }
                    model.ApplyTo(ticketModel);

I'm using JsonPatch to PATCH my objects. I'm trying to add to the collection of Product, just to the end of the collection with this JSON Patch:

[
  {
    "op": "add",
    "path": "/ProductList/-",
    "value":"POWER TETRIS  3P FTTX"
  }
]

It works with simple sub properties like : Customer, Seller. But when I want to add a product in the list object, it doesn't work

harili
  • 406
  • 9
  • 24

0 Answers0