private void btn_deleteDrink_Click(object sender, EventArgs e) { Drink drink = new Drink(); drink.SelectObjectwithID(Oid); drink.Delete(); reLoad(); }
public ActionResult Delete(int id) { Drink deleteDrink = Drink.Find(id); deleteDrink.Delete(); return(RedirectToAction("Index")); }
private void btn_deleteDrink_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có chắc chắn muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Drink drink = new Drink(); drink.SelectObjectwithID(Oid); drink.Delete(); MessageBox.Show("Xóa đồ uống thành công!"); reLoad(); } }
public void Delete_A_Specific_Drink() { //Arrange Drink newDrink1 = new Drink("Americano"); newDrink1.Save(); Drink newDrink2 = new Drink("Latte"); newDrink2.Save(); Assert.IsTrue(Drink.GetAll().Count == 2); //Act newDrink1.Delete(); List <Drink> expectedList = new List <Drink> { newDrink2 }; //Assert List <Drink> outputList = Drink.GetAll(); Assert.IsTrue(outputList.Count == 1); CollectionAssert.AreEqual(expectedList, outputList); }