CQRS.Talk.Refactoring1.Queries.Step2.BasicQueries.FindPersonByEmailQuery.FindPersonByEmail C# (CSharp) Method

FindPersonByEmail() public method

public FindPersonByEmail ( String email, bool isCurrentlyEmployed = null ) : Person
email String
isCurrentlyEmployed bool
return CQRS.Talk.Dependencies.Person
        public Person FindPersonByEmail(String email, bool? isCurrentlyEmployed = null)
        {
            var sql = Sql.Builder.Append("select top 1 * from people")
                         .Append("where email = @0", email);

            if (isCurrentlyEmployed.HasValue)
            {
                sql.Append("and isCurrentlyEmployed = @0", isCurrentlyEmployed);
            }


            var person = database.SingleOrDefault<Person>(sql);

            return person;
        }
    }