Ejemplo n.º 1
0
        public IHttpActionResult PostVersionesPptoActiva(VersionesPptoActiva versionesPptoActiva)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.VersionesPptoActivas.Add(versionesPptoActiva);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (VersionesPptoActivaExists(versionesPptoActiva.Id_VEPR))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = versionesPptoActiva.Id_VEPR }, versionesPptoActiva));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PutVersionesPptoActiva(int id, VersionesPptoActiva versionesPptoActiva)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != versionesPptoActiva.Id_VEPR)
            {
                return(BadRequest());
            }

            db.Entry(versionesPptoActiva).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VersionesPptoActivaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public IHttpActionResult GetVersionesPptoActiva(int id)
        {
            VersionesPptoActiva versionesPptoActiva = db.VersionesPptoActivas.Find(id);

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

            return(Ok(versionesPptoActiva));
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeleteVersionesPptoActiva(int id)
        {
            VersionesPptoActiva versionesPptoActiva = db.VersionesPptoActivas.Find(id);

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

            db.VersionesPptoActivas.Remove(versionesPptoActiva);
            db.SaveChanges();

            return(Ok(versionesPptoActiva));
        }