Exemple #1
0
        public IHttpActionResult PutSPOInfo(int id, SPOInfo sPOInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != sPOInfo.SPOInfoId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
        public IHttpActionResult GetSPOInfo(int id)
        {
            SPOInfo sPOInfo = db.SPOInfoset.Find(id);

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

            return(Ok(sPOInfo));
        }
Exemple #3
0
        public IHttpActionResult PostSPOInfo(SPOInfo sPOInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SPOInfoset.Add(sPOInfo);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = sPOInfo.SPOInfoId }, sPOInfo));
        }
Exemple #4
0
        public IHttpActionResult DeleteSPOInfo(int id)
        {
            SPOInfo sPOInfo = db.SPOInfoset.Find(id);

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

            db.SPOInfoset.Remove(sPOInfo);
            db.SaveChanges();

            return(Ok(sPOInfo));
        }