Exemplo n.º 1
0
        private void BindLists()
        {
            TourService tourService = new TourService(Ioc.GetInstance <ITourRepository>());
            //ShowService showService = new ShowService(Ioc.GetInstance<IShowRepository>());

            var tours = tourService.GetAllToursDescending().ToList();

            if (tours != null && tours.Count > 0)
            {
                tours.ForEach(x =>
                {
                    ddlFavoriteTour.Items.Add(new ListItem(x.TourName, x.TourId.ToString()));
                    ddlFavoriteLiveShowTour.Items.Add(new ListItem(x.TourName, x.TourId.ToString()));
                }
                              );

                var item = new ListItem("Please select a tour", "-1");

                ddlFavoriteTour.Items.Insert(0, item);
                ddlFavoriteLiveShowTour.Items.Insert(0, item);


                //ddlFavoriteLiveShow.Items.Insert(0, item);

                item.Selected = true;
            }
        }
Exemplo n.º 2
0
        private void Bind()
        {
            TourService tourService = new TourService(Ioc.GetInstance <ITourRepository>());
            ShowService showService = new ShowService(Ioc.GetInstance <IShowRepository>());

            ddlTourType.Items.AddRange((from x in tourService.GetAllToursDescending() select new ListItem(x.TourName, x.TourId.ToString())).ToArray());
            ddlShowType.Items.AddRange((from x in showService.GetAllShows() select new ListItem(x.GetShowName(), x.ShowId.ToString())).ToArray());

            ListItem item = new ListItem("Please select either a tour or a song", "-1");

            ddlTourType.Items.Insert(0, item);
            ddlShowType.Items.Insert(0, item);

            item.Selected = true;
        }