public static IEnumerable <SelectListItem> Athletes(IAthleteRepository _athRepo, IEnumerable <decimal> ids) { var athletes = _athRepo.GetAll(); var selectList = new List <SelectListItem>(); if (athletes != null) { foreach (var athlete in athletes) { var item = new SelectListItem(); item.Text = athlete.FirstName + " " + athlete.LastName; item.Value = athlete.AthleteId.ToStringIgnoreFraction(); if (ids.Contains(athlete.AthleteId)) { item.Selected = true; } selectList.Add(item); } } return(selectList); }
public EventViewModel(EventDTO evDto, ITeamRepository _teamRepo, IAthleteRepository _athRepo) { this.EventId = evDto.EventId; this.Name = evDto.Name; this.Sport = evDto.Sport; this.Longitude = evDto.Longitude; this.Latitude = evDto.Latitude; this.Individual = evDto.Individual; this.StartDate = evDto.StartDate; this.EndDate = evDto.EndDate; this.AthleteIds = evDto.AthleteIds; this.TeamIds = evDto.TeamIds; this.UserIds = evDto.UserIds; this.allTeams = _teamRepo.GetAll(); this.allAthletes = _athRepo.GetAll(); this.allSports = ItemListCreator.SportsList(); }
public static IEnumerable<SelectListItem> Athletes(IAthleteRepository _athRepo) { var athletes = _athRepo.GetAll(); var selectList = new List<SelectListItem>(); if (athletes != null) { foreach (var athlete in athletes) { var item = new SelectListItem(); item.Text = athlete.FirstName + " " + athlete.LastName; item.Value = athlete.AthleteId.ToStringIgnoreFraction(); selectList.Add(item); } } return selectList; }
public IEnumerable <Athlete> GetAll() { return(_athleteRepository.GetAll()); }
public ActionResult List() { IEnumerable <Athlete> athletes = _athRepo.GetAll(); return(View(athletes)); }
public IEnumerable <Athlete> GetAthletes() { return(_athleteRepo.GetAll()); }