public ActionResult Edit([Bind(Include = "ProductId,Name,Price")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public bool Update(Empresa emp, out Error.Error err) { Error.Error error = new Error.Error(); try { using (DataAccess.ACMEEntities db = new ACMEEntities()) { Empresas objEmpresa = Mapper.MapperEmpresa.MapSingleEmpresaToEntity(emp); db.Entry(objEmpresa).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } error.mensaje = "EdiciĆ³n realizada con exito."; error.ok = true; } catch (Exception e) { error.ok = false; error.mensaje = "error al editar empresa " + e.Message; } err = error; return(err.ok); }