/// <summary> /// Show the user the details of their protege profile. /// </summary> public async Task <IActionResult> OnGetAsync(string protegeUsername) { //Querys the database to find the protege account linked to the user //and gets the proteges certificates, areasofimporvement, and address Protege = await _context.GetPublicProtegeAsync(protegeUsername); //checks to see if protege exists if not then returns not found if (Protege == null) { return(NotFound()); } return(Page()); }
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")); } }
/// <summary> /// Show the user the details of their protege profile. /// </summary> public async Task <IActionResult> OnGetAsync() { //Querys the database to find the protege account linked to the user //and gets the proteges certificates, areasofimporvement, and address Protege = await _context.Protege .Include(m => m.AppUser) .Include(m => m.Certificates) .Include(m => m.AreasOfImprovement) .Include(m => m.Address) .FirstOrDefaultAsync(m => m.AppUser.UserName == Username); //checks to see if protege exists if not then returns not found if (Protege == null) { return(NotFound()); } return(Page()); }