public IActionResult Post([FromBody] Dish dish)
 {
     if(!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     var result = _repository.CreateDish(dish);
     return CreatedAtAction("Get", new { id = dish.Id }, result);
 }
Ejemplo n.º 2
0
        public IActionResult Post(Dish dish)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var res = _repository.CreateDish(dish);

            return(CreatedAtAction("get", new { dish.Id }, res));
        }