Exemple #1
0
        public ActionResult HealthyRecipes(int MealsPage = 0, int SnacksPage = 0)
        {
            if (MealsPage < 0)
            {
                MealsPage = 0;
            }
            if (SnacksPage < 0)
            {
                SnacksPage = 0;
            }
            ViewBag.MealsPage  = MealsPage;
            ViewBag.SnacksPage = SnacksPage;
            IEnumerable <SyndicationItem> latestMealsItems  = _rssProvider.GetLatest(MealsPage);
            IEnumerable <SyndicationItem> latestMealsItems2 = _rssProvider2.GetLatest(SnacksPage);
            //should not be within controller
            List <RecipeWithPicture> recipes  = new List <RecipeWithPicture>();
            List <RecipeWithPicture> recipes2 = new List <RecipeWithPicture>();

            foreach (SyndicationItem item in latestMealsItems)
            {
                recipes.Add(new RecipeWithPicture(item));
            }
            foreach (SyndicationItem item in latestMealsItems2)
            {
                recipes2.Add(new RecipeWithPicture(item));
            }
            BothRecipesWithSides newModel = BothRecipesWithSides.getFeeds(recipes, recipes2);

            return(View(newModel));
        }
Exemple #2
0
        public static BothRecipesWithSides getLatestTwoRecipes()
        {
            IRssProvider  _rssProvider  = new LunchAndDinnerRssProvider();
            IRssProvider2 _rssProvider2 = new BreakfastsAndSidesRssProvider();
            IEnumerable <SyndicationItem> latestMealsItems  = _rssProvider.GetLatestOne();
            IEnumerable <SyndicationItem> latestMealsItems2 = _rssProvider2.GetLatestOne();
            List <RecipeWithPicture>      recipes           = new List <RecipeWithPicture>();
            List <RecipeWithPicture>      recipes2          = new List <RecipeWithPicture>();

            foreach (SyndicationItem item in latestMealsItems)
            {
                recipes.Add(new RecipeWithPicture(item));
            }
            foreach (SyndicationItem item in latestMealsItems2)
            {
                recipes2.Add(new RecipeWithPicture(item));
            }
            BothRecipesWithSides newModel = BothRecipesWithSides.getFeeds(recipes, recipes2);

            return(newModel);
        }