Add a "consume all ingredients of this recipe" button (this now closes #32)

This commit is contained in:
Bernd Bestel
2018-08-11 11:48:25 +02:00
parent 9a8c61497b
commit 324487d395
7 changed files with 125 additions and 5 deletions

View File

@@ -19,4 +19,17 @@ class RecipesApiController extends BaseApiController
$this->RecipesService->AddNotFulfilledProductsToShoppingList($args['recipeId']);
return $this->VoidApiActionResponse($response);
}
public function ConsumeRecipe(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
try
{
$this->RecipesService->ConsumeRecipe($args['recipeId']);
return $this->VoidApiActionResponse($response);
}
catch (\Exception $ex)
{
return $this->VoidApiActionResponse($response, false, 400, $ex->getMessage());
}
}
}