I am working with asp.net mvc 4. I have to update my persistence store using an edit method, but I want to ignore some columns.
I had found some answers here, but they weren't working for me (I suppose).
Here is my method:
[HttpPost]
public ActionResult Edit(Candidat candidat)
{
ProcRecDB _db = new ProcRecDB(); // from DbContext
if (ModelState.IsValid)
{
_db.Entry(candidat).State = EntityState.Modified;
_db.SaveChanges();
return RedirectToAction("Index");
}
return View(candidat);
}
The Candidate model has 10 properties; how would I ignore some of them?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…