Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 public IEnumerable <Athlete> GetAll()
 {
     return(_athleteRepository.GetAll());
 }
Exemplo n.º 6
0
        public ActionResult List()
        {
            IEnumerable <Athlete> athletes = _athRepo.GetAll();

            return(View(athletes));
        }
Exemplo n.º 7
0
 public IEnumerable <Athlete> GetAthletes()
 {
     return(_athleteRepo.GetAll());
 }