Beispiel #1
0
        public IHttpActionResult PutCATELOGY(int id, CATELOGY cATELOGY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cATELOGY.CATE_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public IHttpActionResult GetCATELOGY(int id)
        {
            CATELOGY cATELOGY = db.CATELOGies.Find(id);

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

            return(Ok(cATELOGY));
        }
Beispiel #3
0
        public IHttpActionResult PostCATELOGY(CATELOGY cATELOGY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CATELOGies.Add(cATELOGY);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = cATELOGY.CATE_ID }, cATELOGY));
        }
Beispiel #4
0
        public IHttpActionResult DeleteCATELOGY(int id)
        {
            CATELOGY cATELOGY = db.CATELOGies.Find(id);

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

            db.CATELOGies.Remove(cATELOGY);
            db.SaveChanges();

            return(Ok(cATELOGY));
        }