0
此代碼是否有任何問題?我的實體沒有得到更新。當調用SaveChanges時,附加實體不會使用新值進行更新
public ActionResult UpdateNota(string notas)
{
if (Request.IsAjaxRequest())
{
RegistroEntities registroEntities = new RegistroEntities();
Nota nota = JsonConvert.DeserializeObject<Nota>(notas);
registroEntities.AttachTo("Notas",nota);
registroEntities.ApplyCurrentValues("Notas", nota);
registroEntities.SaveChanges(SaveOptions.DetectChangesBeforeSave);
return Json(new {success=true});
}
return View();
}