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?
18 Replies
Bit difficult to say without seeing what
accountsLogic.CheckLogin
does.getbyusername basicaly gives you the object with the same username
where are you creating the user?
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
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 foundbut if it did not exist why does it print Welcome Back
i see, it doesn't print Welcome back anywhere else in your code?
nope
where do you set first and last name?
it would just be nice to see where you create the user
like the usermodel class?
and whatever code registers/creates the user
idk if the second picture is readable for you
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 😅🤣
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
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 codeSeems 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.