Esempio n. 1
0
        public ActionResult <RunningRaceOutDto> Get()
        {
            IEnumerable <Race> races = _adoRaceDao.FindAll();

            if (races == null)
            {
                return(NotFound());
            }
            var runningRace = races.FirstOrDefault(race => race.Status.Id == 2 && race.Status.Name == "running");

            if (runningRace == null)
            {
                return(NotFound());
            }
            return(Ok(RunningRaceOutDto.FromRace(runningRace)));
        }
Esempio n. 2
0
        public void Import()
        {
            IEnumerable <Race> races = _adoRaceDao.FindAll();

            foreach (var race in races)
            {
                for (int i = 0; i < race.Type.NumberOfRuns; i++)
                {
                    _adoRunDao.Insert(new Run()
                    {
                        RaceId   = race.Id,
                        RunNo    = i + 1,
                        Running  = (i == 0 && race.Status.Id == 2) ? true : false,
                        Finished = race.Status.Id == 4 ? true : false
                    });
                }
            }
        }
Esempio n. 3
0
        private void GenerateStartLists()
        {
            int          i;
            IList <Race> races = new List <Race>(adoRaceDao.FindAll());

            foreach (var race in races)
            {
                i = 1;
                while (i < GetNumberOfStarters() + 1)
                {
                    StartListMember startListMember = new StartListMember {
                        Race = race
                    };
                    startListMember.SkierId  = GetNewRandomSkierIdForRace(race);
                    startListMember.StartPos = i;
                    StartLists.Add(startListMember);
                    i++;
                }
            }
        }
Esempio n. 4
0
        public ActionResult <IList <RaceOutDto> > GetAll()
        {
            IList <RaceOutDto> raceOutDtos = new List <RaceOutDto>();
            IEnumerable <Race> races       = _adoRaceDao.FindAll();

            if (races == null)
            {
                return(NotFound());
            }
            foreach (var race in races)
            {
                raceOutDtos.Add(new RaceOutDto()
                {
                    Location = race.Location,
                    Name     = race.Name,
                    Sex      = race.Sex,
                    TypeId   = race.Type.Id,
                    TypeName = race.Type.Type
                });
            }
            return(Ok(raceOutDtos));
        }
Esempio n. 5
0
 public void AdoRaceDaoTest()
 {
     Assert.True(raceDao.FindAll().Any());
 }