Pulse7
7/16/2017 - 7:42 AM

Exclude from model binding

Exclude from model binding

[HttpPost]
public ActionResult Edit([Bind(Exclude ="ReviewerName,Review")]RestaurantReview rev)
{
    if (ModelState.IsValid)
    {
        db.Entry(rev).State = EntityState.Modified;
        db.SaveChanges();
        return RedirectToAction("Index",new { id=rev.RestaurantId });
    }
    return View(rev);
}