P1_TrevorGraham/MvcStoreApplication/Repository/Repository.cs
/// <summary>
/// returns an IUser that contains the username if the password is correct. if the username or password is wrong, returns null
/// </summary>
/// <param name="username"></param>
/// <param name="password"></param>
/// <returns></returns>
returns an IUser that contains the username if the password is correct. if the username or password is wrong, returns null
returns an IUser that contains the username if the password is correct . if the username or password is wrong returns null
public IUser AttemptSignInWithUsernameAndPassword(string username, string password)
        {
            Administrator admin = GetAdministratorByUsername(username);
            Customer cust = GetCustomerByUsername(username);
            if (cust != null)
            {
                if (cust.Password == password)
                {
                    return cust;
                }
            }
            else if(admin != null)
            {
                if (admin.Password == password)
                {
                    return admin;
                }
            }
            return null;
        }
public IUser AttemptSignInWithUsernameAndPassword ( string username , string password ) { Administrator admin = GetAdministratorByUsername ( username ) ; Customer cust = GetCustomerByUsername ( username ) ; if ( cust != null ) { if ( cust . Password == password ) { return cust ; } } else if ( admin != null ) { if ( admin . Password == password ) { return admin ; } } return null ; }
returns an IUser that contains the username if the password is correct.
returns an IUser that contains the username if the password is correct .
//check customers //successful login //check admins //successful login //login was not successful
None
username
string
None
password
string
None