public void UpdateMainFoodWithIdLowerThan1()
        {
            var menu = new MainFood()
            {
                Id           = 0,
                MainFoodName = "pasta"
            };
            Exception ex = Assert.ThrowsException <ArgumentException>(() =>
                                                                      mainFoodService.UpdateMainFood(menu));

            Assert.AreEqual("You need to have an higher id than 0", ex.Message);
        }
Esempio n. 2
0
        public ActionResult <MainFood> Put(int id, [FromBody] MainFood mFood)
        {
            try
            {
                var entity = _mainFoodService.UpdateMainFood(mFood);
                entity.MainFoodName = mFood.MainFoodName;
                return(Ok(entity));
            }

            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }