示例#1
0
        public IActionResult Index()
        {
            List <string> restList = new List <string>();

            foreach (Top5 r in Top5.GetTop5s())
            {
                restList.Add("#" + r.Rank + " - " + r.Name + " " + "<br />Favorite Dish: " + r.FavDish + "<br />" + r.Address + "<br />" + r.Phone + "<br />" + r.Website);
            }
            return(View(restList));
        }
        public IActionResult Index()
        {
            List <string> RestaurantList = new List <string>();

            foreach (Top5 r in Top5.GetRestaurant())
            {
                //Below is where I create an array of string objects with the Top5 restaurants to the index page.
                RestaurantList.Add($"#{r.rank}: {r.name} <br>Favorite dish: {r.fav_dish} <br>Address: {r.address} <br>Phone Number: {r.phone} <br>Link: <a href=\"{r.link}\">{r.link}</a>");
            }
            return(View(RestaurantList));
        }
        public IActionResult Index()
        {
            List <string> restList = new List <string>();

            foreach (Top5 t5 in Top5.GetRestaraunts())
            {
                restList.Add($"#{t5.Rank}: {t5.RestaurantName}, {t5.FavDish}, {t5.Address}, {t5.PhoneNum}, {t5.Website}");
            }

            return(View(restList));
        }
示例#4
0
        /*<!--
         * <tr>
         *  <th scope="row">1</th>
         *  <td>Mark</td>
         *  <td>Otto</td>
         *  <td>mdo</td>
         * </tr>-->*/
        public IActionResult Index()
        {
            List <string> FavFood = new List <string>();

            foreach (Top5 t in Top5.GetTop5())
            {
                if (t.Url == "Coming soon...") // no a tag for coming soon
                {
                    FavFood.Add(string.Format("<th scope=\"row\">{0}</th><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td>", t.Rank, t.Name, t.Dish, t.Address, t.Phone, t.Url));
                }
                else
                {
                    FavFood.Add(string.Format("<th scope=\"row\">{0}</th><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td><a target=\"_blank\" href=\"http://{5}\">{5}</a></td>", t.Rank, t.Name, t.Dish, t.Address, t.Phone, t.Url));
                }
            }

            return(View(FavFood));
        }
示例#5
0
        public IActionResult Index()
        {
            //declare and instanciate new list object
            List <string> restaurantlist = new List <string>();

            //populate the list we created in the previous line
            //going to the Band.cs model to reference the GetBands method
            foreach (Top5 r in Top5.GetTop5())
            {
                //adding to the list the created string. The string pulls from the r object the name, ranking, and other information
                //"string interpolation" with the $ by saying there will be things dropped into that string
                restaurantlist.Add($"#{r.Rank}: {r.Name}. " +
                                   $"Best Dish: {r.FavDish}. " +
                                   $"Address: {r.Address}. " +
                                   $"Phone: {r.Phone}. " +
                                   $"Website: {r.Website}. ");
            }

            //pass the view the list we formatted previously
            return(View(restaurantlist));
        }