Unable to Edit Record with Foreign Key Relationship in ASP.NET Core MVC with Entity Framework

22 views Asked by At

I'm encountering an issue in my ASP.NET Core MVC application where I'm unable to edit records in a table that has a foreign key relationship with another table but however when i edit a record in a table that has no foreign key relationship with another table i can able to edit it. why is that? i hope you can help me. thanks you in so much . This is my UserController Code for editing a record:

 public IActionResult EditUserAccount(User obj)
 {
     if (ModelState.IsValid)
     {
         _db.User.Update(obj);
         _db.SaveChanges();

         return RedirectToAction("ManageUserAccount");
     }
     return View();
 }
0

There are 0 answers