Skip to content

Instantly share code, notes, and snippets.

@dgg
Created August 30, 2013 11:09
Show Gist options
  • Select an option

  • Save dgg/6388784 to your computer and use it in GitHub Desktop.

Select an option

Save dgg/6388784 to your computer and use it in GitHub Desktop.
Model binding dynamic collections. IV DeleteController
[HttpPost]
public override ActionResult Index(string save, string discard, DeleteViewModel posted)
{
if (isSave(save, discard))
{
_repository.Save(DeletableThing.ToThings(posted.Things));
}
IEnumerable<Thing> updatedThings = _repository.Find();
var model = new DeleteViewModel
{
Things = DeletableThing.FromThings(updatedThings)
};
return View(model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment