private async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { var items = await DataStore.GetFavouriteRecipesListAsync(); FavouriteRecipes.Clear(); if (items.Count() > 0) { FavouriteRecipes.ReplaceRange(items); } if (FavouriteRecipes.Count > 0) { IsListEmpty = false; } else { IsListEmpty = true; } } finally { IsBusy = false; } }
public async Task <bool> RemoveFavouriteAsync(int id) { var _item = await DataStore.GetRecipeAsync(id); if (_item != null) { await DataStore.UpdateFavouriteAsync(_item, false); FavouriteRecipes.Remove(_item); if (FavouriteRecipes.Count == 0) { IsListEmpty = true; } } return(await Task.FromResult(true)); }