whosrdaddy
Vendor
Hi,
I am a experienced delphi developer and I am attempting my first real c# (asp.net mvc) project.
this piece of code validates my website user.
I am sure it can be be refactored, but i'm not yet fully acquainted with the c# syntax. can someone help me with this?
thanks!
/Daddy
-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
I am a experienced delphi developer and I am attempting my first real c# (asp.net mvc) project.
this piece of code validates my website user.
I am sure it can be be refactored, but i'm not yet fully acquainted with the c# syntax. can someone help me with this?
Code:
user = userRepository.GetByUserName(userName);
if (user != null)
{
if (user.UserName == null && user.UserName != userName)
{
validationMessage = "Invalid username";
return false;
}
if (user.Password != password)
{
validationMessage = "Invalid password";
return false;
}
}
else
{
validationMessage = "Invalid username";
return false;
}
thanks!
/Daddy
-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!