public async Task <IActionResult> PutTDetalleFactura([FromRoute] long id, [FromBody] TDetalleFactura tDetalleFactura) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tDetalleFactura.IdDetalleFactura) { return(BadRequest()); } _context.Entry(tDetalleFactura).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TDetalleFacturaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTDetalleFactura([FromBody] TDetalleFactura tDetalleFactura) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } tDetalleFactura.BActivo = (byte)Estados.EstadoEnum.Activo; tDetalleFactura.FCreacion = DateTime.Now; _context.TDetalleFactura.Add(tDetalleFactura); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTDetalleFactura", new { id = tDetalleFactura.IdDetalleFactura }, tDetalleFactura)); }