public/Set-RecipeFavorite.ps1
|
function Set-RecipeFavorite { [CmdletBinding()] param( [Parameter(Mandatory)][int]$RecipeId, [Parameter(Mandatory)][bool]$IsFavorite ) $fav = if ($IsFavorite) { 1 } else { 0 } $favAt = if ($IsFavorite) { "datetime('now')" } else { "NULL" } Invoke-RecipeDbQuery -Query @" UPDATE Recipes SET IsFavorite = $fav, FavoritedAt = $favAt, UpdatedAt = datetime('now') WHERE RecipeId = $RecipeId; "@ | Out-Null } |