Skip to content

Instantly share code, notes, and snippets.

@dgg
Created August 30, 2013 07:48
Show Gist options
  • Save dgg/6387288 to your computer and use it in GitHub Desktop.
Save dgg/6387288 to your computer and use it in GitHub Desktop.
Model binding dynamic collections. III Controller
[HttpPost]
public ActionResult Index(string save, string discard, SortViewModel posted)
{
if (isSave(save, discard))
{
_repository.Save(SortableThing.ToThings(posted.Things));
}
IEnumerable<Thing> updatedThings = _repository.Find();
var model = new SortViewModel
{
Things = SortableThing.FromThings(updatedThings)
};
return View(model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment