コード例 #1
0
        // GET: Leagues
        public async Task <IActionResult> Index()
        {
            var currentUser = await User.GetApplicationUser(_userManager);

            return
                (View(_leaguesRepository.GetLeagues(currentUser).ToList().Select(l => new LeagueViewModel
            {
                Id = l.Id,
                Name = l.Name,
                CreatedByUserId = l.CreatedByUserId
            })));
        }
コード例 #2
0
        // GET: Invites/Create
        public async Task <IActionResult> Create(Guid?leagueId)
        {
            var currentUser = await User.GetApplicationUser(_userManager);

            var leagues = _leaguesRepository.GetLeagues(currentUser).ToList();

            if (leagueId.HasValue && _leaguesRepository.GetUserAuthorizedLeague(currentUser, leagueId.Value) == null)
            {
                return(NotFound());
            }

            if (!leagues.Any())
            {
                return(RedirectToAction("NoLeagues", "Leagues"));
            }

            return(View(new InviteViewModel
            {
                LeagueId = leagueId,
                Leagues = leagues
            }));
        }