public IHttpActionResult PutProtocoloDetalleImpresion(ProtocoloDetalleImpresion protocoloDetalleImpresion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (protocoloDetalleImpresion.ultimoUsr == null || protocoloDetalleImpresion.ultimoUsr == 0) { return(BadRequest("no hay usuario para guardar")); } protocoloDetalleImpresion.ultimaFec = DateTime.Now; db.Entry(protocoloDetalleImpresion).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProtocoloDetalleImpresionExists(protocoloDetalleImpresion.idProtocoloDetImpresion)) { return(NotFound()); } else { throw; } } return(Ok(protocoloDetalleImpresion)); }
public IHttpActionResult GetProtocoloDetalleImpresion(int id) { ProtocoloDetalleImpresion protocoloDetalleImpresion = db.ProtocoloDetalleImpresion.Find(id); if (protocoloDetalleImpresion == null) { return(NotFound()); } return(Ok(protocoloDetalleImpresion)); }
public IHttpActionResult DeleteProtocoloDetalleImpresion(int id) { ProtocoloDetalleImpresion protocoloDetalleImpresion = db.ProtocoloDetalleImpresion.Find(id); if (protocoloDetalleImpresion == null) { return(NotFound()); } db.ProtocoloDetalleImpresion.Remove(protocoloDetalleImpresion); db.SaveChanges(); return(Ok()); }
public IHttpActionResult PostProtocoloDetalleImpresion(ProtocoloDetalleImpresion protocoloDetalleImpresion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (protocoloDetalleImpresion.ultimoUsr == null || protocoloDetalleImpresion.ultimoUsr == 0) { return(BadRequest("no hay usuario para guardar")); } protocoloDetalleImpresion.ultimaFec = DateTime.Now; db.ProtocoloDetalleImpresion.Add(protocoloDetalleImpresion); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = protocoloDetalleImpresion.idProtocoloDetImpresion }, protocoloDetalleImpresion)); }