Beispiel #1
0
        public IHttpActionResult PutIN_Category(int id, IN_Category iN_Category)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != iN_Category.CategoryID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public IHttpActionResult GetIN_Category(int id)
        {
            IN_Category iN_Category = db.IN_Category.Find(id);

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

            return(Ok(iN_Category));
        }
Beispiel #3
0
        public IHttpActionResult PostIN_Category(IN_Category iN_Category)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.IN_Category.Add(iN_Category);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = iN_Category.CategoryID }, iN_Category));
        }
Beispiel #4
0
        public IHttpActionResult DeleteIN_Category(int id)
        {
            IN_Category iN_Category = db.IN_Category.Find(id);

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

            db.IN_Category.Remove(iN_Category);
            db.SaveChanges();

            return(Ok(iN_Category));
        }