P1_TrevorGraham/MvcStoreApplication/BusinessLogic/BusinessLogic.cs
/// <summary>
/// attempts to login based on a username and password, and if successful, sets the session values to the correct values
/// </summary>
/// <param name="username"></param>
/// <param name="password"></param>
/// <returns></returns>
attempts to login based on a username and password, and if successful, sets the session values to the correct values
attempts to login based on a username and password and if successful sets the session values to the correct values
public bool AttemptSignIn(string username, string password)
        {
            IUser user = _repository.AttemptSignInWithUsernameAndPassword(username, password);
            if (user == null)
            {
                return false;
            }
            else if (user is Customer)
            {
                SetCurrentLocation(_repository.GetCustomerById(user.UserId).DefaultLocation.LocationId);
            }
            else
            {
                SetCurrentLocation(_repository.GetDefautLocation().LocationId);
            }
            SessionAssignCurrentUser(user.UserId);
            return true;
        }
public bool AttemptSignIn ( string username , string password ) { IUser user = _repository . AttemptSignInWithUsernameAndPassword ( username , password ) ; if ( user == null ) { return false ; } else if ( user is Customer ) { SetCurrentLocation ( _repository . GetCustomerById ( user . UserId ) . DefaultLocation . LocationId ) ; } else { SetCurrentLocation ( _repository . GetDefautLocation ( ) . LocationId ) ; } SessionAssignCurrentUser ( user . UserId ) ; return true ; }
attempts to login based on a username and password, and if successful, sets the session values to the correct values
attempts to login based on a username and password and if successful sets the session values to the correct values
//assign current location //var customer = _repository.GetCustomerById(user.UserId); //currentLocationId = _repository.GetCustomerById(user.UserId).DefaultLocation.LocationId; //currentLocationId = _repository.GetDefautLocation().LocationId; //assign current user //currentUserId = user.UserId;
None
username
string
None
password
string
None