Ejemplo n.º 1
0
        public IActionResult Index(int?clubId)
        {
            ViewBag.lstClubs = new SelectList(clubService.GetAll(), "Id", "Naam");

            if (clubId != null)
            {
                var clublist = wedstrijdService.GetWedstrijdenByClub(Convert.ToInt32(clubId));

                List <WedstrijdVM> listClubVM = _mapper.Map <List <WedstrijdVM> >(clublist);

                foreach (WedstrijdVM wedstrijdVM in listClubVM)
                {
                    int    wedId    = wedstrijdVM.Id;
                    string stadNaam = stadionService.GetStadionById(wedstrijdService.GetWedstrijdById(Convert.ToInt32(wedId)).ThuisClub.StadionId).Naam;
                    wedstrijdVM.StadionNaam = stadNaam;
                    wedstrijdVM.Vakken      = new SelectList(vakService.GetAll(), "Id", "Omschrijving");
                }

                return(View(listClubVM));
            }

            var list = wedstrijdService.GetAll();

            var listVM = _mapper.Map <List <WedstrijdVM> >(list);

            foreach (WedstrijdVM wedstrijdVM in listVM)
            {
                int    wedId    = wedstrijdVM.Id;
                string stadNaam = stadionService.GetStadionById(wedstrijdService.GetWedstrijdById(Convert.ToInt32(wedId)).ThuisClub.StadionId).Naam;
                wedstrijdVM.StadionNaam = stadNaam;
                wedstrijdVM.Vakken      = new SelectList(vakService.GetAll(), "Id", "Omschrijving");
            }

            return(View(listVM));
        }
        // GET: /<controller>/
        public IActionResult Index()
        {
            ShoppingCartVM cartList =
                HttpContext.Session.GetObject <ShoppingCartVM>("ShoppingCart");

            if (cartList != null)
            {
                if (cartList.Cart != null)
                {
                    foreach (CartVM cart in cartList.Cart)
                    {
                        cart.Ringen = new SelectList(ringService.GetAll(), "RingFactor", "Naam");
                        cart.Vakken = new SelectList(vakService.GetAll(), "VakFactor", "Naam");
                    }
                }
                if (cartList.AbonnementCart != null)
                {
                    foreach (AbonnementCartVM abonnementCart in cartList.AbonnementCart)
                    {
                        abonnementCart.Ringen = new SelectList(ringService.GetAll(), "RingFactor", "Naam");
                        abonnementCart.Vakken = new SelectList(vakService.GetAll(), "VakFactor", "Naam");
                    }
                }
            }

            return(View(cartList));
        }
Ejemplo n.º 3
0
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Club club = clubService.GetClubById(Convert.ToInt32(id));

            if (club == null)
            {
                return(NotFound());
            }

            var clubDetails = new ClubVM();

            clubDetails = _mapper.Map <ClubVM>(club);


            clubDetails.Vakken = new SelectList(vakService.GetAll(), "Id", "Omschrijving");


            return(View(clubDetails));
        }