public IHttpActionResult PutMAGAZINE(int id, MAGAZINE mAGAZINE)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mAGAZINE.MagazineID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetMAGAZINE(int id)
        {
            MAGAZINE mAGAZINE = db.MAGAZINEs.Find(id);

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

            return(Ok(mAGAZINE));
        }
        public IHttpActionResult PostMAGAZINE(MAGAZINE mAGAZINE)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MAGAZINEs.Add(mAGAZINE);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = mAGAZINE.MagazineID }, mAGAZINE));
        }
        public IHttpActionResult DeleteMAGAZINE(int id)
        {
            MAGAZINE mAGAZINE = db.MAGAZINEs.Find(id);

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

            db.MAGAZINEs.Remove(mAGAZINE);
            db.SaveChanges();

            return(Ok(mAGAZINE));
        }
Example #5
0
 internal static HandleRef getCPtr(MAGAZINE obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }