Comparing lists of objects and update
- by user2915962
I have a view, passing a LIST of Originals to this method.
Before the post happened, i changed some of the properties.
I now receive the updated list as a parameter in my method and would like
to update the database with these new values.
[HttpPost]
public ActionResult NewValue(Page model)
{
var ListOfOriginals = Session.Query<Original>().ToList(); //GETS the objects i want to update
listOfOriginals = Model.Pages // Model.page is the new list containing the updated values
RavenSession.SaveChanges();
return RedirectToAction("Index");
}
When i debug, i can see that listOfOriginals gets the new values.
The problem is that i dont know how to update the RavenDB whith these new values.
I tried adding this: Session.Store(listOfOriginals) before the SaveChanges() but that resulted in an error. Maybe there is a much better way of doing this?