Ejemplo n.º 1
0
        public IHttpActionResult PutAccTraDesCategory(int id, AccTraDesCategory accTraDesCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != accTraDesCategory.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PostAccTraDesCategory(AccTraDesCategory accTraDesCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AccTraDesCategories.Add(accTraDesCategory);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = accTraDesCategory.ID }, accTraDesCategory));
        }
Ejemplo n.º 3
0
        public IHttpActionResult DeleteAccTraDesCategory(int id)
        {
            AccTraDesCategory accTraDesCategory = db.AccTraDesCategories.Find(id);

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

            db.AccTraDesCategories.Remove(accTraDesCategory);
            db.SaveChanges();

            return(Ok(accTraDesCategory));
        }