Пример #1
0
        // POST: odata/OrderNotes
        public IHttpActionResult Post(order_notes order_notes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.order_notes.Add(order_notes);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (order_notesExists(order_notes.order_notes_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Created(order_notes));
        }
Пример #2
0
        // DELETE: odata/OrderNotes(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            order_notes order_notes = db.order_notes.Find(key);

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

            db.order_notes.Remove(order_notes);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        // PUT: odata/OrderNotes(5)
        public IHttpActionResult Put([FromODataUri] int key, Delta <order_notes> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            order_notes order_notes = db.order_notes.Find(key);

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

            patch.Put(order_notes);

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

            return(Updated(order_notes));
        }