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); }
public AddFood(DAL.Menu menu, DAL.MenuItem menuItem = null) { InitializeComponent(); this.menu = menu; this.MenuItem = menuItem; this.LoadData(); }
public IHttpActionResult PostMenu(Menu menu) { if (!ModelState.IsValid) { return BadRequest(ModelState); } repository.AddMenu(menu); return CreatedAtRoute("DefaultApi", new { id = menu.Id }, menu); }
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(); } }
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(); } }
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; } }