Пример #1
0
        public static RecipeDocument CreateFrom(Uri uri)
        {
            var data = RecipeScraper.GetRecipeData(uri);

            return(new RecipeDocument
            {
                Id = GenerateGuidFromUrl(uri),
                Name = data.Name,
                Author = data.Author?.Name,
                Description = data.Description,
                Image = data.Image,
                Rating = data.AggregateRating?.RatingValue ?? 0,
                Ingredients = string.Join("\n", data.RecipeIngredient),
                Steps = string.Join("\n", data.RecipeInstructions.Select(x => x.Text)),
                TimeToCook = GetTime(data.TotalTime),
            });
        }
        public static RecipeDocument CreateFrom(Uri uri)
        {
            RecipeDto data = RecipeScraper.GetRecipeData(uri);

            return(new RecipeDocument
            {
                Id = GenerateGuidFromUrl(uri),
                Url = uri,
                Name = data.Name,
                Author = data.Author?.Name,
                Description = data.Description,
                Image = data.Image,
                Rating = data.AggregateRating?.RatingValue ?? 0,
                TimeToCook = GetTime(data.TotalTime),
                Ingredients = MapList(data.RecipeIngredient),
                Steps = MapList(data.RecipeInstructions, x => x.Text),
                Categories = MapList(data.Categories, x => x.Name)
            });
        }