public async Task <ActionResult <DishDto> > NewDish(int restaurantId, DishForCreationDto dish) { if (!await _dishesRepository.RestaurantExists(restaurantId)) { return(NotFound()); } var newDish = _mapper.Map <Dish>(dish); newDish.RestaurantId = restaurantId; await _dishesRepository.AddAsync(newDish); if (await _dishesRepository.SaveChangesAsync()) { return(CreatedAtAction("GetDish", new { restaurantId, id = newDish.Id }, _mapper.Map <DishDto>(newDish))); } return(BadRequest()); }