public ActionResult Edit([Bind(Include = "OrderId,ProductId,UnitPrice,Quantity,Discount")] OrderDetail orderDetail) { if (ModelState.IsValid) { db.Entry(orderDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Orders, "Id", "CustomerId", orderDetail.OrderId); ViewBag.ProductId = new SelectList(db.Products, "Id", "ProductName", orderDetail.ProductId); return(View(orderDetail)); }