You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ShopNCook/Views/FavoritesPage.xaml.cs

28 lines
765 B

using Models;
namespace ShoopNCook.Pages;
using Endpoint;
using Models;
using ShoopNCook.Views;
public partial class FavoritesPage : ContentPage
{
public FavoritesPage(Account account, IRecipesService service)
{
InitializeComponent();
//TODO this code can be factorised (see HomePage, MyListPage)
service.LookupFavoritesOf(account).ForEach(info =>
{
RecipeViewLayout.Children.Add(new RecipeView(info, () =>
{
Recipe recipe = service.GetRecipe(info);
AccountRecipeRate rate = service.GetRateOf(account, recipe);
Shell.Current.Navigation.PushAsync(new RecipePage(recipe, rate, 1));
}));
});
}
}