I'm new in entity and wrote a function to update a particular field TStatus. Here is what I'm trying to execute:-
public ActionResult UpdateTStatus(int ICCID) {
using (var db = new MyDBContext())
{
var result = db.INTERVIEW_AGENT_CALL_CENTERS.Where(g => g.Id == ICCID).FirstOrDefault();
if (result != null)
{
result.TStatus= 10;
db.Entry(result).State = EntityState.Modified;
db.SaveChanges();
return Content("Result = "+result.TStatus);
}
else
{
return Content("An Error");
}
}
return View();
}
Whenever I'm executing the method and run a direct query on SQL Server I'm getting the old value of TStatus.
Aucun commentaire:
Enregistrer un commentaire