/// <inheritdoc /> public async Task Load(long recipeId, IReadOnlyCollection <WorkplanViewModel> workplans) { _isSelfManagedRecipe = true; var recipeModel = await ProductServiceModel.GetRecipe(recipeId); await LoadTypeAndWorkplans(recipeModel, workplans); WorkplanViewModel wp = null; if (recipeModel.WorkplanId != 0) { wp = workplans.FirstOrDefault(w => w.Id == recipeModel.WorkplanId); } EditableObject = new RecipeViewModel(recipeModel) { Workplan = wp }; }
private async Task LoadRecipesByIds() { var recipes = new List <RecipeModel>(); try { foreach (var recipeId in _preSelectedRecipeIds) { var recipe = await ProductServiceModel.GetRecipe(recipeId); recipes.Add(recipe); } } catch (Exception e) { DialogManager.ShowMessageBox($"{Strings.RecipeWorkspaceViewModel_ErrorLoadingRecipes_Message} {e}", Strings.RecipeWorkspaceViewModel_ErrorLoadingRecipes_Title); throw; } await Execute.OnUIThreadAsync(() => AddRecipeToCollection(recipes.ToArray())); }