//
        public BootcampSessionAddAng Get(int id)
        {
            //create a new view model, passing in the desired
            //session id and name
            BootcampSessionAddAng ang = new BootcampSessionAddAng
            {
                BootcampSessionId = id
            };

            ang.BootcampName = _bootcampRepo.GetBootcampByID(id).Name;

            //add all of the bootcamp's locations to the view model
            foreach (BootcampLocation location in _bootcampLocationsRepo.GetAllBootcampLocationsByBootcampId(id))
            {
                Location    locationById = _locationRepo.GetLocationById(location.LocationID);
                LocationAng item         = new LocationAng
                {
                    LocationId = location.LocationID,
                    Name       = locationById.City + ", " + locationById.Country
                };
                ang.Locations.Add(item);
            }

            //add all of the bootcamp's technologies to the view model
            foreach (BootcampTechnology technology in _bootcampTechRepo.GetAllBootcampTechnologiesByBootcampId(id))
            {
                TechnologyAng ang3 = new TechnologyAng
                {
                    TechnologyId = technology.TechnologyID.Value,
                    Name         = _techRepo.GetTechnologyById(technology.TechnologyID.Value).Name
                };
                ang.Technologies.Add(ang3);
            }
            return(ang);
        }
Exemple #2
0
        public AdminBootcampListViewModel Get()
        {
            AdminBootcampListViewModel model = new AdminBootcampListViewModel();

            //loop through each bootcamp and convert format for view model
            foreach (Bootcamp bootcamp in _bootcampRepo.GetAllBootcamps())
            {
                BootcampListAng item = new BootcampListAng
                {
                    BootcampID    = bootcamp.BootcampID,
                    Name          = bootcamp.Name,
                    LengthInWeeks = bootcamp.LengthInWeeks,
                    PriceString   = Helper.GetPriceString(bootcamp.Price, _locationRepo.GetLocationById(bootcamp.LocationID).Country)
                };


                Location locationById = _locationRepo.GetLocationById(bootcamp.LocationID);
                item.Location   = locationById.City + ", " + locationById.Country;
                item.Technology = _techRepo.GetTechnologyById(bootcamp.PrimaryTechnologyID).Name;

                //add each converted bootcamp object to the view model
                model.Bootcamps.Add(item);
            }

            //get each location and convert format for view model (drop down list)
            foreach (Location location2 in _locationRepo.GetAllLocations())
            {
                LocationAng ang2 = new LocationAng
                {
                    LocationId = location2.LocationID,
                    Name       = location2.City + ", " + location2.Country
                };
                model.Locations.Add(ang2);
            }

            //get each technology and convert format for view model (drop down list)
            foreach (Technology technology in _techRepo.GetAllTechnologies())
            {
                TechnologyAng ang3 = new TechnologyAng
                {
                    TechnologyId = technology.TechnologyID,
                    Name         = technology.Name
                };
                model.Technologies.Add(ang3);
            }
            return(model);
        }
Exemple #3
0
        public AdminBootcampTechnologyViewModel Get()
        {
            AdminBootcampTechnologyViewModel model = new AdminBootcampTechnologyViewModel();

            //get all bootcamp technologies, and convert each to correct format
            //before adding each to the angular view model
            foreach (BootcampTechnology technology in _bootcampTechRepo.GetAllBootcampTechnologies())
            {
                BootcampTechnologyAng item = new BootcampTechnologyAng
                {
                    BootcampTechnologyId = technology.BootcampTechnologyID,
                    BootcampName         = _bootcampRepo.GetBootcampByID(technology.BootcampID.Value).Name,
                    Technology           = _techRepo.GetTechnologyById(technology.TechnologyID.Value).Name
                };
                model.BootcampTechnologies.Add(item);
            }

            //get all bootcamps (name and id) and add to the model
            foreach (Bootcamp bootcamp in _bootcampRepo.GetAllBootcamps())
            {
                BootcampAng ang2 = new BootcampAng
                {
                    BootcampID = bootcamp.BootcampID,
                    Name       = bootcamp.Name
                };
                model.Bootcamps.Add(ang2);
            }

            //get all technologies (name and id) and add to the view model
            foreach (Technology technology2 in _techRepo.GetAllTechnologies())
            {
                TechnologyAng ang3 = new TechnologyAng
                {
                    TechnologyId = technology2.TechnologyID,
                    Name         = technology2.Name
                };
                model.Technologies.Add(ang3);
            }
            return(model);
        }