public async Task <IActionResult> PutDepartamento([FromRoute] int id, [FromBody] DepartamentoDTO departamento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != departamento.Id) { return(BadRequest()); } _context.Entry(Mapper.Map <Departamento>(departamento)).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartamentoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutProductos([FromRoute] int id, [FromBody] Productos productos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != productos.Id) { return(BadRequest()); } _context.Entry(productos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult AsignarPrecio([Bind(Include = "Codigo,Nombre,Descripcion,PrecioVenta,PrecioSugerido")] Producto producto) { //if ((string)Session["Tipo"] == "Empleado") //{ if (ModelState.IsValid && producto.PrecioVenta >= producto.PrecioSugerido && producto.PrecioVenta <= (producto.PrecioSugerido * 1.10)) { if (ModelState.IsValid) { db.Entry(producto).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } //} return(View(producto)); }
public ActionResult Edit([Bind(Include = "ID,Nombre,Apellidos,FechaNcimiento,DepartamentoID")] Empleado empleado) { if (ModelState.IsValid) { db.Entry(empleado).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(empleado)); }
public ActionResult Edit([Bind(Include = "Id,PrecioVenta,Cantidad,Fecha")] LineaPedido pedido) { if (ModelState.IsValid) { db.Entry(pedido).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pedido)); }
public ActionResult Edit([Bind(Include = "Id,Mail,Password,RolCliente")] Usuario usuario) { if (ModelState.IsValid) { db.Entry(usuario).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(usuario)); }
public ActionResult Edit([Bind(Include = "IdEmpresa,NomeEmpresa,CNPJ,NomeRepresentante")] Empresa empresa) { if (ModelState.IsValid) { db.Entry(empresa).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(empresa)); }
public ActionResult Edit([Bind(Include = "ID,Nombre,Descripcion,Activo")] Departamento departamento) { if (ModelState.IsValid) { db.Entry(departamento).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(departamento)); }
public ActionResult Edit([Bind(Include = "ID,Numero,Lada,Extension,EmpleadoID")] Telefono telefono) { if (ModelState.IsValid) { db.Entry(telefono).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(telefono)); }
public IActionResult DeleteConfirmed(int id) { /*var cliente = empresaContext.Cliente.Find(id); * empresaContext.Remove(cliente); * empresaContext.SaveChanges();*/ var cliente = _context.Cliente.Find(id); cliente.IsDeleted = true; _context.Entry(cliente).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("index")); }
public void Alterar(Dependente dependente) { _context.Entry(dependente).State = System.Data.Entity.EntityState.Modified; }
public void Alterar(Funcionario funcionario) { _context.Entry(funcionario).State = EntityState.Modified; }