public ActionResult HeroList() { IHeroRepo herorepo = HeroRepoFactory.Create(); var model = herorepo.GetAllHeroes(); return(View(model.ToList())); }
public SightingVM() { //SelectedHeroesID = new List<int>(); HeroList = new List <SelectListItem>(); SightingHeroes = herorepo.GetAllHeroes(); SightingLocation = locationrepo.GetAllLocations(); }
public OrgVM() { OrganizationHeroes = new HashSet <Hero>(); HeroList = new List <SelectListItem>(); var AllHeroes = herorepo.GetAllHeroes(); LocationList = new List <SelectListItem>(); var AllLocations = locationrepo.GetAllLocations(); SelectedHeroesID = new List <int>(); foreach (var locoitem in AllLocations) { LocationList.Add(new SelectListItem { Value = locoitem.LocationID.ToString(), Text = locoitem.LocationName }); } foreach (var item in AllHeroes) { HeroList.Add(new SelectListItem { Value = item.HeroID.ToString(), Text = item.HeroName }); } }
public ActionResult EditSighting(int SightingID) { IHeroRepo herorepo = HeroRepoFactory.Create(); ISightingRepo repo = SightingRepoFactory.Create(); Sighting s = repo.GetSightingsById(SightingID); //int locationid = s.SightingLocation.LocationID; var model = new SightingVM() { SightingObject = repo.GetSightingsById(SightingID), Date = s.Date, SightingHeroes = herorepo.GetAllHeroes(), SightingID = s.SightingID }; model.SightingObject.SelectedHeroesID = new List <int>(); foreach (var hero in s.SightingHeroes) { model.SightingObject.SelectedHeroesID.Add(hero.HeroID); } return(View(model)); }