private void buttonDel_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { logic.Delete(new CategoryBindingModel { Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value) }); LoadData(); } }
public void DeleteCategory() { CategoryLogic c = new CategoryLogic(this.categrepo.Object, this.comprepo.Object, this.sponsorrepo.Object); Category newc = new Category() { CategoryId = Guid.NewGuid().ToString(), Name = CategoryType.ClassicPhysique, StartingWeight = 87, MaximumWeight = 111 }; categrepo.Setup(x => x.Delete(It.IsAny <Category>())); c.Delete(newc.CategoryId); categrepo.Verify(x => x.Delete(newc.CategoryId), Times.Once); }
public IHttpActionResult Delete(int id) { { if (id <= 0) { return(BadRequest("Not a valid category id")); } //using (DishRepo repo = new DishRepo(databaseContext)) //{ // repo.Delete(id); //} CategoryLogic categ = new CategoryLogic(); categ.Delete(id); return(Ok("This category is deleted")); } }
private void buttonDelete_Click(object sender, EventArgs e) { if (dataGridViewCategories.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = Convert.ToInt32(dataGridViewCategories.SelectedRows[0].Cells[0].Value); try { logic.Delete(new CategoryBindingModel { Id = id }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadData(); } } }
// DELETE: api/Category/5 public void Delete(int id) { categoryLogic.Delete(id); }
public void DeleteCategory(string uid) { logic.Delete(uid); }
public IActionResult DeleteCategory(string id) { categorylogic.Delete(id); return(View(nameof(ListCategories), categorylogic.List())); }