I currently have a bunch of methods in my controllers which take selected records from table rows.
So I might have something like
var ids = [];
var prices = [];
var customers = [];
$selectedRow.each(function() {
ids.push($(this).find('.id').text());
prices.push($(this).find('.price').text());
customers.push($(this).find('.customer').text());
});
$.post(....) // AJAX call to controller method
And in the controller I end up with
public ActionResult DoSomething(int[] ids, double[] prices, string[] customers) { ... }
which is just a bit messy to deal with using iterators.
What I'd really like is to have
Class Foo
{
int id;
double price;
string customer;
}
and be able to receive
public ActionResult DoSomething(List<Foo> foos) { ... }
is this possible?