public ActionResult Edit([Bind(Include = "id,name,note")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "id,code,name,sort_name,note,category_id")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.category_id = new SelectList(db.Categories, "id", "name", product.category_id); return(View(product)); }