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)); }
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)); }