So I have an edit page for bios
[Route("Bio/BioEdit/{USER_ID}/{BIO_SEQ}")]
public ActionResult BioEdit(Int32 USER_ID, Int16 BIO_SEQ)
{
var bioRecord = db.BIOS.Where(x => x.USER_ID == DMCID && x.BIO_SEQ == BIO_SEQ).FirstOrDefault();
return View(bioRecord);
}
This succesfully finds the Bio I want to update, and returns a view with a table and the data from the bio that's editable..
Now I have another action for editing with http Post that looks like
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult BioEdit([Bind(Include = "BIO_CONTENT")] DAL.BIOS bio)
{
// ??
return View();
}
Since I'm getting a bio item from the post, can I use that directly and do something like bio.Update()
or do I need to also Bind the BIO_SEQ and USER_ID fields again so I can do something like
var bioRecord = db.BIOS
.Where(x => x.USER_ID == DMCID && x.BIO_SEQ == BIO_SEQ).FirstOrDefault()
.Update(x => new DAL.BIOS() {
BIO_CONTENT: bio.BIO_CONTENT
});