public ActionResult Index() { var model = new HomeIndexViewModel(); //cycle through each bootcamp foreach (FutureCodr.Models.Bootcamp bootcamp in _bootcampRepo.GetAllBootcamps()) { //convert each into correct format for view model and add to model FutureCodr.UI.Models.Home.Bootcamp item = ConvertBootcampFormat(bootcamp); model.Bootcamps.Add(item); } //populate search dropdowns with all locations, technologies, and price ranges model.SearchParams.Populate(_locationRepo.GetAllLocations(), _technologyRepo.GetAllTechnologies()); return View(model); }
public IActionResult Get() { try { var results = _repository.GetAllTechnologies(); return(Ok(results)); } catch (Exception ex) { _logger.LogError("Technologies could not be loaded.", ex); return(BadRequest(ex.Message)); } }
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); }
public IEnumerable <TechnologyViewModel> List() { try { var technologies = _repository.GetAllTechnologies(); if (technologies != null) { return(technologies); } else { return(null); } } catch (Exception) { return(null); } }
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); }
public void GetAllTechnologiesTest() { Assert.AreEqual(repo.GetAllTechnologies().Count, 16); }
public IEnumerable <Technology> Get() { return(_techRepo.GetAllTechnologies()); }
public ViewResult GetTechnologyList() { return(View(_techRepository.GetAllTechnologies())); }
public IEnumerable <TechnologyViewModel> List() { var technologies = _repository.GetAllTechnologies(); return(technologies); }