public ActionResult Edit(Product product) { if (ModelState.IsValid) { _context.Entry(product).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Categories = _context.Categories.Select(c => new SelectListItem { Text = c.Name, Value = c.Id.ToString() }).ToList(); return(View(product)); }
public virtual void Update(T updatedEntity) { _context.Entry(updatedEntity).State = EntityState.Modified; }