Exemplo n.º 1
0
        public void DeleteFood(int id)
        {
            BFood          food           = new BFood(id);
            FoodController foodController = new FoodController();

            foodController.DeleteFood(food);
        }
Exemplo n.º 2
0
        public void Test2(int foodId, string name)
        {
            FoodController foodCont = new FoodController(null, null, context.Object);
            FoodModel      food     = new FoodModel {
                FoodId = foodId, Name = name
            };
            OkObjectResult json       = (OkObjectResult)foodCont.DeleteFood(food);
            FoodModel      returnFood = (FoodModel)json.Value;

            _output.WriteLine($"{returnFood.Name}");
            Assert.Equal(name, returnFood.Name);
        }
        private void deleteclicked(object sender, EventArgs e)
        {
            string  id   = tbID.Text;
            dynamic food = FoodController.DeleteFood(id);

            if (food)
            {
                MessageBox.Show("Delete Food successfully...");
            }
            else
            {
                MessageBox.Show("Food Not Found", "Food Delete", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }