public async Task <IActionResult> PutCliente(int id, Cliente cliente) { if (id != cliente.IdCliente) { return(BadRequest()); } _context.Entry(cliente).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutMedidor(int id, Medidor medidor) { if (id != medidor.IdMedidor) { return(BadRequest()); } _context.Entry(medidor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MedidorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> PostOrdenAsync([FromBody] Models.Orden orden) { _context.Ordenes.Add(orden); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetOrdenByNumeroOrdenAsync), new { numeroorden = orden.NumeroOrden }, null)); }
public async Task <ActionResult <Orden> > PostAsignacion(Orden orden) { orden.Estado = 'A'; _context.Orden.Add(orden); await _context.SaveChangesAsync(); return(CreatedAtAction("GetOrden", new { id = orden.IdOrden }, orden)); }