My question is little theoretical but it's interesting one. I want to know which approach is best while using web api.
I've two methods
- One has
List<Customer>as parameter
public void Create(List<Customer>) { //... }
- Second has
CustomerListas parameter (Where CustomerList class has propertypublic List<Customer> customers {get; set;})
public void Create(CustomerList customer) { //... }
I know how for method 1, I need to pass json array and for method two I need to wrap json array to json object.
But my question is which approach is best and why?
List<Customer>. On the other hands, if you want customers and additional data, you use latter approach.