Je veux mettre à jour l'objet avec LINQ to Entities, comme ceci:Comment mettre à jour l'objet complet avec linq aux entités?
public ActionResult SubmitPool(SwimmingPool Pool)
{
SwimmingPool IsPool = (from sp in db.SwimmingPool
where sp.Id == Pool.Id
select sp).First();
if (IsPool != null) {
IsPool = Pool;
db.SaveChanges();
}
}
Mais cela ne ...
Si je ne:
public ActionResult SubmitPool(SwimmingPool Pool)
{
SwimmingPool IsPool = (from sp in db.SwimmingPool
where sp.Id == Pool.Id
select sp).First();
if (IsPool != null) {
----> IsPool.Name = Pool.Name;
db.SaveChanges();
}
}
Il fait! Mais je veux mettre à jour l'objet complet. Comment faire?
je pense qu'il devrait automapper dans des situations plus critiques pas simple comme ça, – Stacker