Member_2_1242703
asked on
Updating specific fields only in MVC/Entity controller
I'm currently using this action to edit a record in my database table:
It updates the fields I want, but it sets everything else to NULL. How do I get it to just update the fields I want and not anything else?
public ActionResult Edit([Bind(Include = "ID,StartDate,EndDate,Type,Hours,Comments")] PTO_REQUEST pTO_REQUEST)
{
if (ModelState.IsValid)
{
db.Entry(pTO_REQUEST).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Create");
}
return View(pTO_REQUEST);
}
It updates the fields I want, but it sets everything else to NULL. How do I get it to just update the fields I want and not anything else?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER