public ActionResult Edit([Bind(Include = "Id,Name")] 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,Name,CategoryId,BrandId,Description,Image,Quantity,Price")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BrandId = new SelectList(db.Brands, "Id", "Name", product.BrandId); ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", product.CategoryId); return(View(product)); }
public ActionResult Edit([Bind(Include = "Id,ProductId,BuyerId,Date,Price")] PurchaseHistory purchasehistory) { if (ModelState.IsValid) { db.Entry(purchasehistory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", purchasehistory.ProductId); ViewBag.BuyerId = new SelectList(db.Users, "Id", "Username", purchasehistory.BuyerId); return(View(purchasehistory)); }
public void Update(TEntity entity) { mmContext.Entry(entity).State = EntityState.Modified; }