コード例 #1
0
        public IHttpActionResult Posthired_alumni(hired_alumni hired_alumni)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.hired_alumni.Add(hired_alumni);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (hired_alumniExists(hired_alumni.alumni_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = hired_alumni.alumni_id }, hired_alumni));
        }
コード例 #2
0
        public IHttpActionResult Puthired_alumni(int id, hired_alumni hired_alumni)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hired_alumni.alumni_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult Gethired_alumni(int id)
        {
            hired_alumni hired_alumni = db.hired_alumni.Find(id);

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

            return(Ok(hired_alumni));
        }
コード例 #4
0
        public IHttpActionResult Deletehired_alumni(int id)
        {
            hired_alumni hired_alumni = db.hired_alumni.Find(id);

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

            db.hired_alumni.Remove(hired_alumni);
            db.SaveChanges();

            return(Ok(hired_alumni));
        }