Ejemplo n.º 1
0
        public ActionResult Index(TradeFilterView tradeListView)
        {
            //create select lists with teams
            League league = db.Leagues.Find(tradeListView.LeagueId);
            Team myTeam = league.Teams.Where(t => t.MyTeam).FirstOrDefault();
            SelectList myTeamOptions = new SelectList(league.Teams, "TeamId", "Name", myTeam.TeamId);
            SelectList otherTeamOptions = new SelectList(league.Teams, "TeamId", "Name");

            ViewBag.MyTeamOptions = myTeamOptions;
            ViewBag.OtherTeamOptions = otherTeamOptions;

            return View(tradeListView);
        }
Ejemplo n.º 2
0
        // GET: Trades
        public ActionResult Index(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            League league = db.Leagues.Find(id);

            //create select lists with teams
            Team myTeam = league.Teams.Where(t => t.MyTeam).FirstOrDefault();
            SelectList myTeamOptions = new SelectList(league.Teams, "TeamId", "Name");
            SelectList otherTeamOptions = new SelectList(league.Teams, "TeamId", "Name");

            ViewBag.MyTeamOptions = myTeamOptions;
            ViewBag.OtherTeamOptions = otherTeamOptions;

            TradeFilterView tradeListView = new TradeFilterView(league.LeagueId);
            tradeListView.LeagueId = league.LeagueId;
            tradeListView.MyTeamId = myTeam.TeamId;

            return View(tradeListView);
        }