コード例 #1
0
        public IActionResult Buy()
        {
            IEnumerable <ConcertModel> concerts        = _concertQuery.GetConcerts();
            IList <SelectListItem>     selectListItems = new List <SelectListItem>();

            foreach (var concert in concerts)
            {
                selectListItems.Add(new SelectListItem {
                    Value = concert.Id.ToString(), Text = concert.Title
                });
            }
            return(View(new BuyTicketsViewModel()
            {
                ConcertIds = selectListItems
            }));
        }
コード例 #2
0
 public IActionResult Index()
 {
     return(View(_query.GetConcerts()));
 }