public ActionResult Editar(Fornecedor fornecedor) { _db.Fornecedores.Attach(fornecedor); _db.Entry(fornecedor).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index", "Fornecedor")); }
public ActionResult Edit([Bind(Include = "EmployeeID,FirstName,LastName,Title,EmailAddress,DepartmentName")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Sku,Details,ImagePath,Notes,CategoryId")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categorys, "Id", "Description", product.CategoryId); return(View(product)); }