C
C#•2w ago
CarlJohnson

Why does this not print the firstname and lastname

Yo, im trying to make a login function in c$. Logging in works but it does not want to print the first and last name it only prints welcome back. How come?
No description
No description
18 Replies
Esa
Esa•2w ago
Bit difficult to say without seeing what accountsLogic.CheckLogin does.
CarlJohnson
CarlJohnson•2w ago
No description
CarlJohnson
CarlJohnson•2w ago
getbyusername basicaly gives you the object with the same username
er🎃
er🎃•2w ago
where are you creating the user?
CarlJohnson
CarlJohnson•2w ago
in my sign up code i ask all values they need to put in and make it a Usermodel than i write the account to the database
er🎃
er🎃•2w ago
the user must not exist, or your GetByUserName logic is flawed it can't be found, so you need to figure out why it can't be found
CarlJohnson
CarlJohnson•2w ago
but if it did not exist why does it print Welcome Back
er🎃
er🎃•2w ago
i see, it doesn't print Welcome back anywhere else in your code?
CarlJohnson
CarlJohnson•2w ago
nope
er🎃
er🎃•2w ago
where do you set first and last name? it would just be nice to see where you create the user
CarlJohnson
CarlJohnson•2w ago
like the usermodel class?
er🎃
er🎃•2w ago
and whatever code registers/creates the user
CarlJohnson
CarlJohnson•2w ago
idk if the second picture is readable for you
No description
No description
er🎃
er🎃•2w ago
and what does UserAccess.Write do? you just need to provide all the parts involved in this code, we can't just guess the implementation 😅
CarlJohnson
CarlJohnson•2w ago
No description
CarlJohnson
CarlJohnson•2w ago
🤣 too much different code I made a Tostring method for usermodel and i see that it gives the wrong ID, no firstname, no lastname, no username, good password, good isadmin
FusedQyou
FusedQyou•2w ago
I suggest you validate that your database has the credentials added at all Idk what UserAccess is, but the next step is to go as deep as possible into the logic to the first instance where the user is fetched from the database. Validate that this has the data Finally, follow the flow and figure out why it suddenly disappeared We can't help you because you haven't shared the relevant code
gDotDev
gDotDev•2w ago
Seems pretty simple to debug. Firstly run in debug mode and check what the value of first and last name are. If it’s only printing Welcome Back, I’d presume that first name and last name aren’t being set and are therefore default value of empty string. Once you deduce if this is the case, then debug line by line your code flow and work out why the values aren’t being set.
Want results from more Discord servers?
Add your server