示例#1
0
        public IHttpActionResult PutINCRIPCION(int id, INCRIPCION iNCRIPCION)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != iNCRIPCION.ID_INCRIPCION)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public IHttpActionResult GetINCRIPCION(int id)
        {
            INCRIPCION iNCRIPCION = db.INCRIPCION.Find(id);

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

            return(Ok(iNCRIPCION));
        }
示例#3
0
        public IHttpActionResult PostINCRIPCION(INCRIPCION iNCRIPCION)
        {
            if (!ModelState.IsValid || db.INCRIPCION.Any(ins => ins.ID_INCRIPCION == iNCRIPCION.ID_INCRIPCION))
            {
                return(BadRequest(ModelState));
            }

            db.INCRIPCION.Add(iNCRIPCION);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = iNCRIPCION.ID_INCRIPCION }, iNCRIPCION));
        }
示例#4
0
        public IHttpActionResult DeleteINCRIPCION(int id)
        {
            INCRIPCION iNCRIPCION = db.INCRIPCION.Find(id);

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

            db.INCRIPCION.Remove(iNCRIPCION);
            db.SaveChanges();

            return(Ok(iNCRIPCION));
        }