Exemplo n.º 1
0
        public IHttpActionResult PutMenu(int id, Menu menu)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != menu.Id)
            {
                return BadRequest();
            }
            try
            {
                repository.EditMenu(id, menu);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!repository.MenuExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Exemplo n.º 2
0
 public AddFood(DAL.Menu menu, DAL.MenuItem menuItem = null)
 {
     InitializeComponent();
     this.menu     = menu;
     this.MenuItem = menuItem;
     this.LoadData();
 }
Exemplo n.º 3
0
        public IHttpActionResult PostMenu(Menu menu)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            repository.AddMenu(menu);

            return CreatedAtRoute("DefaultApi", new { id = menu.Id }, menu);
        }
Exemplo n.º 4
0
        private void btnEditMenu_Click(object sender, EventArgs e)
        {
            DAL.Menu menu = (DAL.Menu) this.tabControl.SelectedTab.Tag;

            AddMenu      addMenu = new AddMenu(menu);
            DialogResult dr      = addMenu.ShowDialog();

            if (dr == DialogResult.OK)
            {
                this.LoadData();
            }
        }
Exemplo n.º 5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DAL.Menu     menu = (DAL.Menu) this.tabControl.SelectedTab.Tag;
            DialogResult dr   = MessageBox.Show("Delete menu \"" + menu.Name + "\"", "Confirm", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                MenuBLL menuBLL = new MenuBLL();
                menuBLL.Delete(menu);
                this.LoadData();
            }
        }
Exemplo n.º 6
0
        private void menuItemControl_OnEdit(MenuItemControl sender)
        {
            DAL.Menu menu = (DAL.Menu) this.tabControl.SelectedTab.Tag;

            AddFood      addFoodDialog = new AddFood(menu, sender.MenuItem);
            DialogResult dr            = addFoodDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                sender.MenuItem = addFoodDialog.MenuItem;
            }
        }