Comparing lists of objects and update
Posted
by
user2915962
on Stack Overflow
See other posts from Stack Overflow
or by user2915962
Published on 2014-05-21T15:33:28Z
Indexed on
2014/06/03
15:26 UTC
Read the original article
Hit count: 272
asp.net-mvc
|ravendb
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?
© Stack Overflow or respective owner