Esempio n. 1
0
        public async Task <IActionResult> AddFood([FromBody] Food food)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await db.AddAsync(food);

            await db.SaveChangesAsync();

            return(Ok(food.Id));
        }