c# - How to make an Edit operation properly in ASP.NET MVC4? -


I am trying to make an update like this:

  [http post ] [ValidateNetworking Tokens] Public Action Result Modifier (OSMODEL OS) {if (ModelState.IsValid) {_db.Entry (OS) .set = EntityState.Modified; // Success ! String str = "o"; Redirect return action ("index", new {str = str}); } // failed! See Return (OS); }   

After updating an OS line using this, the row is not updated. What is wrong in this matter?

OSModel <{p>

  [table ("OS")] Public class OSMDell {{Key] Public IT IDO (Receive); Set; } [Required] public string nameOS {get; Set; } [Required] public string versionOS {get; Set; } [Required] public string versionOS {get; Set; } [Required] public string servicepackOS {get; Set; } [Required] public int bitsOS {get; Set; } Public OSMDell () {}}   

In debug mode, I get the full data of the separate input OS of the ID that is set to 0.

The thing is that you _db.SaveChanges () after _dn.Entry (OS) ..data = ... , try to save the changes to the database:

  [http post] [legitimate antigoukri token] public actioners Modifier (OSMODELE OS) {if (ModelState.IsValid) {_db.Entry (OS) .set = EntityState.Modified; _db.SaveChanges (); // You must add this line // success! String str = "o"; Redirect return action ("index", new {str = str}); } // failed! See Return (OS); }    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -