public IActionResult GetStudentProfile(int id) { var student = _studentService.GetStudentProfile(id); if (student != null) { return(Ok(student)); } return(BadRequest(new { title = "Couldnt find student" })); }
public async Task <IActionResult> GetStudentProfile() { //Get Request's User var claimsIdentity = (ClaimsIdentity)this.User.Identity; if (!claimsIdentity.IsAuthenticated) { return(Unauthorized()); } var claim = claimsIdentity.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier); var userEmail = claim.Value; var User = await _userManager.FindByEmailAsync(userEmail); //Get Student Profile var Profile = _profileSrv.GetStudentProfile(User); return(Ok(new { Status = "Success", Profile })); }
private void Initialize() { this.profileService = new StudentProfileService(); this.Student = profileService.GetStudentProfile(User.UserId); }