コード例 #1
0
        public ActionResult tres()
        {
            var country = serviceCountry.GetMany().ToList();
            List <SelectListItem> li = new List <SelectListItem>();

            li.Add(new SelectListItem {
                Text = "--Select Country--", Value = "0"
            });

            foreach (var m in country)
            {
                li.Add(new SelectListItem {
                    Text = m.CountryName, Value = m.CountryID.ToString()
                });
                ViewBag.country = li;
            }
            return(View());
        }
コード例 #2
0
        // GET: Countries
        public ActionResult Countries()
        {
            var co = serviceCountry.GetMany().ToList();

            return(View(co));
        }