Exemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync()
        {
            var mentor = await _context.GetMentorAsync(this.Username);

            if (mentor?.Mentor == null)
            {
                return(Redirect("/Error"));
            }

            var pairs = await _context.GetPairsForMentorAsync(mentor.Mentor.ID);

            this.Display = new List <DisplayModel>();
            foreach (var pair in pairs)
            {
                var display = new DisplayModel
                {
                    ClientUserName  = pair.Client?.AppUser?.UserName ?? "",
                    DateCreated     = pair.DateCreated.ToShortDateString(),
                    JoinCode        = pair.JoinCode,
                    PairID          = pair.PairID,
                    ProtegeUserName = pair.Protege?.AppUser?.UserName ?? ""
                };

                this.Display.Add(display);
            }

            return(Page());
        }