Beispiel #1
0
        public IHttpActionResult PostMENU_ITEM(MENU_ITEM mENU_ITEM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MENU_ITEM.Add(mENU_ITEM);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MENU_ITEMExists(mENU_ITEM.MENU_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mENU_ITEM.MENU_ID }, mENU_ITEM));
        }
Beispiel #2
0
        public IHttpActionResult PutMENU_ITEM(int id, MENU_ITEM mENU_ITEM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mENU_ITEM.MENU_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        void addMenuItem(ToolStripMenuItem menu, string title, MENU_ITEM item, SHORTCUT shortCut)
        {
            ToolStripMenuItem mi;

            if (shortCut.Key == Keys.None)
            {
                mi = new ToolStripMenuItem()
                {
                    Font = menuFont,
                    Text = title
                };
            }
            else
            {
                mi = new ToolStripMenuItem()
                {
                    Font                     = menuFont,
                    Text                     = title,
                    ShowShortcutKeys         = true,
                    ShortcutKeys             = shortCut.Key,
                    ShortcutKeyDisplayString = shortCut.Name,
                };
            }
            mi.Click += new EventHandler((sender, e) => {
                mSim.Performed(item);
            });
            mMainMenuItems.Add(mi);
            menu.DropDownItems.Add(mi);
        }
Beispiel #4
0
        public IHttpActionResult GetMENU_ITEM(int id)
        {
            MENU_ITEM mENU_ITEM = db.MENU_ITEM.Find(id);

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

            return(Ok(mENU_ITEM));
        }
Beispiel #5
0
        public IHttpActionResult DeleteMENU_ITEM(int id)
        {
            MENU_ITEM mENU_ITEM = db.MENU_ITEM.Find(id);

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

            db.MENU_ITEM.Remove(mENU_ITEM);
            db.SaveChanges();

            return(Ok(mENU_ITEM));
        }