Updating an object with L2S with ASP.NET MVC
- by Paul
Is there an easier way to update an object with L2S other then doing it property by property?
This is what I am doing now:
Public ActionResult Edit(Object obj)
{
var objToUpdate = _repository.Single<Object>(o => o.id = obj.id);
objToUpdate.Prop1 = obj.Prob1;
objToUpdate.Prop2 = obj.Prop2;
...
_repository.SubmitChanges();
}
I am hoping there is a way to just say objToUpdate = obj then submit the changes???
Any help on this would be appreciated!