Exemple #1
0
        public static IList <string> GetResultWithEngineNames(int raceNumber)
        {
            F1StatsDatabaseEntities db           = new F1StatsDatabaseEntities();
            EredmenyLogic           eredmenyRepo = new EredmenyLogic(new EredmenyRepository(db));
            var query = from x in eredmenyRepo.GetAllEredmeny()
                        where x.versenyhetvege_szam == raceNumber
                        orderby x.helyezes
                        select x.Versenyzo.Csapat.motor;

            return(query.ToList());
        }
        public static IList <string> TestGetResultWithEngineNames(int raceNumber, IEredmenyRepository eRepo, ICsapatRepository csRepo, IVersenyzoRepository vRepo)
        {
            EredmenyLogic  eredmenyRepo = new EredmenyLogic(eRepo);
            CsapatLogic    csapatLogic  = new CsapatLogic(csRepo);
            VersenyzoLogic vLogic       = new VersenyzoLogic(vRepo);
            var            query        = from x in eredmenyRepo.GetAllEredmeny()
                                          where x.versenyhetvege_szam == raceNumber
                                          join y in vLogic.GetAllVersenyzo() on x.rajtszam equals y.rajtszam
                                          join z in csapatLogic.GetAllCsapat() on y.csapat_nev equals z.csapat_nev
                                          orderby x.helyezes
                                          select z.motor;

            return(query.ToList());
        }
Exemple #3
0
        public static IList <ElertPont> GetDriversPoints()
        {
            F1StatsDatabaseEntities db           = new F1StatsDatabaseEntities();
            EredmenyLogic           eredmenyRepo = new EredmenyLogic(new EredmenyRepository(db));
            VersenyzoLogic          verRepo      = new VersenyzoLogic(new VersenyzoRepository(db));
            var query = from x in eredmenyRepo.GetAllEredmeny()
                        group x by x.rajtszam into g
                        join y in verRepo.GetAllVersenyzo() on g.Key equals y.rajtszam
                        select new ElertPont
            {
                DriverName = y.nev,
                Points     = g.Sum(z => z.pont.GetValueOrDefault()),         // ez jó? :thinking:
            };

            return(query.ToList());
        }
        public static IList <ElertPont> TestGetDriversPoints(IEredmenyRepository eRepo, IVersenyzoRepository vRepo)
        {
            EredmenyLogic  eredmenyRepo = new EredmenyLogic(eRepo);
            VersenyzoLogic verRepo      = new VersenyzoLogic(vRepo);
            var            query        = from x in eredmenyRepo.GetAllEredmeny()
                                          group x by x.rajtszam into g
                                          join y in verRepo.GetAllVersenyzo() on g.Key equals y.rajtszam
                                          select new ElertPont
            {
                DriverName = y.nev,
                Points     = g.Sum(z => z.pont),
            };
            var res = query.ToList();

            res.Sort(SortByPoints);
            return(res);
        }
        public static IList <ElertPont> GetDriversPoints()
        {
            F1StatsDbContext db           = new F1StatsDbContext("placeholder");
            EredmenyLogic    eredmenyRepo = new EredmenyLogic(new EredmenyRepository(db));
            VersenyzoLogic   verRepo      = new VersenyzoLogic(new VersenyzoRepository(db));
            var query = from x in eredmenyRepo.GetAllEredmeny()
                        group x by x.rajtszam into g
                        join y in verRepo.GetAllVersenyzo() on g.Key equals y.rajtszam
                        select new ElertPont
            {
                DriverName = y.nev,
                Points     = g.Sum(z => z.pont),
            };
            var res = query.ToList();

            res.Sort(SortByPoints);
            return(res);
        }