public ActionResult Edit([Bind(Include = "CateegoryId,CategoryName,IsActive,IsDelete")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "ProductId,ProductName,CategoryId,CreatedDate,ModifiedDate,Description,ProductImage,Price")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; product.ModifiedDate = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "CateegoryId", "CategoryName", product.CategoryId); return(View(product)); }