Exemplo n.º 1
0
 public Prognostic(string league)
 {
     dB      = new FootbalEntities();
     Results = new List <string> {
         "1", "X", "2"
     };
     League       = dB.Ligas.Find(league);
     ResultsList  = new SelectList(Results);
     HomeTeamList = new SelectList(dB.Equipos.OrderBy(x => x.Nombre).Where(x => x.Liga.Equals(league)), "Nombre", "Nombre");
     AwayTeamList = new SelectList(dB.Equipos.OrderBy(x => x.Nombre).Where(x => x.Liga.Equals(league)), "Nombre", "Nombre");
 }
Exemplo n.º 2
0
        public ActionResult Create(Bet model)
        {
            var prognostic = new Prognostic
            {
                AwayTeam = model.AwayTeam,
                HomeTeam = model.HomeTeam,
            };

            var Results = new List <string> {
                "1", "X", "2"
            };
            var Dictionary = new Dictionary <string, ProgResultList>();

            foreach (var result in Results)
            {
                prognostic.result = result;
                var progResults = new ProgResultList();

                progResults.Add(appControl.calculateShare(prognostic));
                progResults.Add(appControl.calculateShare(prognostic, 8));
                progResults.Add(appControl.calculateShare(prognostic, 6));
                progResults.Add(appControl.calculateShare(prognostic, 3));

                Dictionary.Add(result, progResults);
            }


            foreach (var prog in Dictionary)
            {
                foreach (var progResult in prog.Value.getList())
                {
                    var betProg = new BetPrognostic
                    {
                        Condition    = prog.Key,
                        Matchs       = progResult.MatchsPlayed,
                        HomePercent  = progResult.HomePercent,
                        AwayPercent  = progResult.AwayPercent,
                        TotalPercent = progResult.TotalPercent,
                        Share        = progResult.Share,
                    };

                    model.BetPrognostics.Add(betProg);
                }
            }

            var db = new FootbalEntities();

            db.Bets.Add(model);
            db.SaveChanges();


            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 3
0
 public gEquipo(string Team)
 {
     teamList  = new List <Equipos>();
     this.Team = Team;
     db        = new FootbalEntities();
 }
Exemplo n.º 4
0
 public gEquipo()
 {
     teamList = new List <Equipos>();
     db       = new FootbalEntities();
 }
Exemplo n.º 5
0
 public gPartido(string team)
 {
     this.Team = team;
     db        = new FootbalEntities();
 }
Exemplo n.º 6
0
 public gPartido()
 {
     db = new FootbalEntities();
 }
Exemplo n.º 7
0
 public gLeague()
 {
     db        = new FootbalEntities();
     this.list = db.Ligas.ToList();
 }