Example #1
0
        public BootcampLocationViewModel Get()
        {
            BootcampLocationViewModel model = new BootcampLocationViewModel();

            //get all bootcamp locations to be displayed in overview table
            foreach (BootcampLocation location in _bootcampLocationsRepo.GetAllBootcampLocations())
            {
                //for each bootcamp location, convert format and add to view model
                Location            locationById = _locationRepo.GetLocationById(location.LocationID);
                BootcampLocationAng item         = new BootcampLocationAng
                {
                    Id       = location.BootcampLocationID,
                    Bootcamp = _bootcampRepo.GetBootcampByID(location.BootcampID).Name,
                    Location = locationById.City + ", " + locationById.Country
                };
                model.BootcampLocations.Add(item);
            }

            //get all bootcamps with their Ids for drop down list
            foreach (Bootcamp bootcamp in _bootcampRepo.GetAllBootcamps())
            {
                //convert format
                BootcampAng ang2 = new BootcampAng
                {
                    BootcampID = bootcamp.BootcampID,
                    Name       = bootcamp.Name
                };

                //add converted technology to the list
                model.Bootcamps.Add(ang2);
            }

            //get all locations with their Ids for drop down list
            foreach (Location location3 in _locationRepo.GetAllLocations())
            {
                //convert format
                LocationAng ang3 = new LocationAng
                {
                    LocationId = location3.LocationID,
                    Name       = location3.City + ", " + location3.Country
                };

                //add converted location to list
                model.Locations.Add(ang3);
            }
            return(model);
        }
Example #2
0
 public void GetAllBootcampLocationsTest()
 {
     Assert.AreEqual(_locationsRepo.GetAllBootcampLocations().Count, 3);
 }