public AdminBootcampSessionListViewModel Get()
        {
            AdminBootcampSessionListViewModel model = new AdminBootcampSessionListViewModel();

            //get all bootcamp sessions and convert their format for view model
            foreach (BootcampSession session in _bootcampSessionRepo.GetAllBootcampSessions())
            {
                BootcampSessionAng item = new BootcampSessionAng
                {
                    BootcampSessionId = session.BootcampSessionID,
                    BootcampName      = _bootcampRepo.GetBootcampByID(session.BootcampID.Value).Name
                };
                Location locationById = _locationRepo.GetLocationById(session.LocationID.Value);
                item.Location   = locationById.City + ", " + locationById.Country;
                item.Technology = _techRepo.GetTechnologyById(session.TechnologyID.Value).Name;
                item.StartDate  = session.StartDate.ToString("d");
                item.EndDate    = session.EndDate.ToString("d");

                //add converted bootcamp session to model
                model.Sessions.Add(item);
            }

            //get a list of all bootcamps (in converted format) for drop down list
            foreach (Bootcamp bootcamp in _bootcampRepo.GetAllBootcamps())
            {
                BootcampAng ang2 = new BootcampAng
                {
                    BootcampID = bootcamp.BootcampID,
                    Name       = bootcamp.Name
                };
                model.Bootcamps.Add(ang2);
            }
            return(model);
        }
Пример #2
0
        public void GetAllBootcampSessionsTest()
        {
            var result = repo.GetAllBootcampSessions().Count;

            Assert.AreEqual(result, 13);
        }