public ActionResult Edit([Bind(Include = "Id,CategoryId,CompanyId,ModelName,Description")] Product product) { if (ModelState.IsValid) { _db.Entry(product).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(_db.Categories, "Id", "Name", product.CategoryId); ViewBag.CompanyId = new SelectList(_db.Companies, "Id", "PersianName", product.CompanyId); return(View(product)); }
public void Update(TEntity item) { _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); }