public void createMainfoodWithoutName()
        {
            var menu = new MainFood()
            {
            };
            Exception ex = Assert.ThrowsException <ArgumentException>(() =>
                                                                      mainFoodService.AddMainFood(menu));

            Assert.AreEqual("Main Food needs a name.", ex.Message);
        }
Exemple #2
0
        public ActionResult <MainFood> Post([FromBody] MainFood mFood)
        {
            try
            {
                return(Ok(_mainFoodService.AddMainFood(mFood)));
            }

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