public ActionResult Edit([Bind(Include = "CompanyId,Name")] Company company) { if (ModelState.IsValid) { db.Entry(company).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(company)); }
public ActionResult Edit([Bind(Include = "Id,ProductName,CompanyId,Price,Active,Stock,IdDeleted")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CompanyId = new SelectList(db.Company, "CompanyId", "Name", product.CompanyId); return(View(product)); }