public void Update(T item) { using (var context = new ModelDataEntities2()) { context.Entry(item).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "Id,Dato,Sum,ID_Manager,ID_Client,ID_Product")] SaleInfo saleInfo) { if (ModelState.IsValid) { db.Entry(saleInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_Client = new SelectList(db.Client, "Id", "ClientName", saleInfo.Client.ClientName); ViewBag.ID_Manager = new SelectList(db.Manager, "Id", "ManagerName", saleInfo.ID_Manager); ViewBag.ID_Product = new SelectList(db.Product, "Id", "ProductName", saleInfo.ID_Product); return(View(saleInfo)); }