Beispiel #1
0
        public async Task <IActionResult> OnGetAsync(string mentorUsername)
        {
            Mentor = await _context.GetPublicMentorAsync(mentorUsername);

            if (Mentor == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            var user = await _userManager.FindByNameAsync(User.Identity.Name);

            if (!ModelState.IsValid)
            {
                this.UserType = this.PopulateUserType(user);
                return(Page());
            }

            var selected = this.Input.TypeId;


            switch (selected)
            {
            default:
                this.UserType = this.PopulateUserType(user);
                return(RedirectToPage("/"));

            case 0:
                var mentor = new Data.Mentor();
                user.Mentor = mentor;
                await _userManager.UpdateAsync(user);

                await _context.SaveChangesAsync();

                return(Redirect("/Mentor/ProfileBuilder/Create"));

            case 1:
                var protege = new Data.Protege();
                user.Protege = protege;
                await _userManager.UpdateAsync(user);

                await _context.SaveChangesAsync();

                return(Redirect("/Protege/ProfileBuilders/CreateProtege"));

            case 2:
                var Client = new Data.Client();
                user.Client = Client;
                await _userManager.UpdateAsync(user);

                await _context.SaveChangesAsync();

                return(Redirect("/Client/ProfileCreation/CreateClient"));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gets the details for mentor
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnGetAsync()
        {
            //Gets all the data associated with the mentor based on the username
            Mentor = await _context.Mentor
                     .Include(m => m.AppUser)
                     .Include(m => m.Certificates)
                     .Include(m => m.StrategicDomains)
                     .Include(m => m.Address)
                     .FirstOrDefaultAsync(m => m.AppUser.UserName == Username);

            //checks to see if mentor is null
            if (Mentor == null)
            {
                return(NotFound());
            }
            return(Page());
        }