//[Authorize] public IActionResult getorcreateuser([FromBody] UserDtoCreation uservariable) { //string userId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value; var userOrnull = _userInfoRepository.ReturnUserorNull(uservariable.Id); var inviteOrnulll = _userInfoRepository.ReturnInviteorNull(uservariable.Id); //check to see if user is in the database //check to see if user is in the invite table if (userOrnull != null) { //ready to patch userOrnull.Authorization = uservariable.Authorization; _context.SaveChanges(); } //if neither //add user to database if (userOrnull == null && inviteOrnulll == null) { var createdUser = _userInfoRepository.CreateUser(uservariable.Id, uservariable.Description, uservariable.Authorization); return(Ok(uservariable.Id)); } // if in the database and not in the invite table //do nothing // if not in the database and in the invite table // add the user, add learner details, and enroll with the classroomID in the invite table if (userOrnull == null && inviteOrnulll != null) { var createdUser = _userInfoRepository.CreateUserLearnerAndEnroll(uservariable.Id, inviteOrnulll.Email, inviteOrnulll.ClassroomID); return(Ok(uservariable.Id)); } // if in the database and in the invite table //do nothing return(Ok(uservariable.Id)); //return CreatedAtRoute("GetUser", new //{ // id = createdUserToReturn.Id //}, createdUserToReturn); }