Beispiel #1
0
        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));
        }
Beispiel #2
0
        public IHttpActionResult GetProtocoloDetalleImpresion(int id)
        {
            ProtocoloDetalleImpresion protocoloDetalleImpresion = db.ProtocoloDetalleImpresion.Find(id);

            if (protocoloDetalleImpresion == null)
            {
                return(NotFound());
            }

            return(Ok(protocoloDetalleImpresion));
        }
Beispiel #3
0
        public IHttpActionResult DeleteProtocoloDetalleImpresion(int id)
        {
            ProtocoloDetalleImpresion protocoloDetalleImpresion = db.ProtocoloDetalleImpresion.Find(id);

            if (protocoloDetalleImpresion == null)
            {
                return(NotFound());
            }

            db.ProtocoloDetalleImpresion.Remove(protocoloDetalleImpresion);
            db.SaveChanges();

            return(Ok());
        }
Beispiel #4
0
        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));
        }