public async void DeleteCookbookButtonClicked(CookbookDto cookbook) { if (cookbook.Name == TargetedCookbook) { RestoreInitialState(); cookbook.CookbookId = CookbookIdToBeDeleted; await DeleteCookbook(cookbook); return; } }
private async Task DeleteCookbook(CookbookDto cookbook) { string apiName = string.Format($"api/Cookbooks/{cookbook.CookbookId}"); var response = await Http.DeleteAsync(apiName); if (response.IsSuccessStatusCode) { Console.WriteLine("Successfully deleted cookbook: " + cookbook.Name + " (" + cookbook.CookbookId + ")"); await OnInitializedAsync(); } HideDeleteCookbookDialog(); }
public void HideDeleteCookbookDialog() { RestoreInitialState(); cookbookDto = new CookbookDto(); }
public void ShowHideDeleteCookbookDialog(CookbookDto cookbook) { CookbookIdToBeDeleted = cookbook.CookbookId; TargetedCookbook = cookbook.Name; DeleteCookbookButtonClicked(); }