views:

135

answers:

0

Hi there

If I have [0].propertyname, [1].propertyname, etc in my FormCollection how would I go about updating the model?

if I do this:

public ActionResult Edit(int id, FormCollection collection){

        IList<SoilSamplingSubJob> sssj = orderRepository.FindSubOrders_collection(id);  
        UpdateModel(sssj, collection.ToValueProvider());
}    

it doesnt update.

or trying the updates individually:

public ActionResult Edit(int id, FormCollection collection){

IList<SoilSamplingSubJob> sssj = orderRepository.FindSubOrders_collection(id);  

foreach (var sj in sssj)
UpdateModel(sj, collection.ToValueProvider());
}

still no joy.

trying an ICollection on the original entity (i.e. sequential [0], [1] etc)

public ActionResult Edit(int id, FormCollection collection){

ICollection<SoilSamplingSubJob> sssj = orderRepository.FindSubOrders_collection(id);  

foreach (var sj in sssj)
UpdateModel(sj, collection.ToValueProvider());
}

i think doesnt work either. Can anyone spot my mistake? Should I write a new ValueProvider?