Beispiel #1
0
        [TableView(true)] //Table view == List View
        public static IQueryable <Customer> FindIndividualCustomerByName(

            [Optionally] string firstName,
            string lastName,
            IQueryable <Person> persons,
            IQueryable <Customer> customers)
        {
            IQueryable <Person> matchingPersons = PersonRepository.FindContactByName(firstName, lastName, persons);

            return(from c in customers
                   from p in matchingPersons
                   where c.PersonID == p.BusinessEntityID
                   select c);
        }
        public static IQueryable <SalesPerson> FindSalesPersonByName(

            [Optionally] string firstName,
            string lastName,
            IQueryable <Person> persons,
            IQueryable <SalesPerson> sps)
        {
            IQueryable <Person> matchingPersons = PersonRepository.FindContactByName(firstName, lastName, persons);

            return(from sp in sps
                   from person in matchingPersons
                   where sp.BusinessEntityID == person.BusinessEntityID
                   orderby sp.EmployeeDetails.PersonDetails.LastName, sp.EmployeeDetails.PersonDetails.FirstName
                   select sp);
        }
        public static IQueryable <Employee> FindEmployeeByName(

            [Optionally] string firstName,
            string lastName,
            IQueryable <Person> persons,
            IQueryable <Employee> employees)
        {
            IQueryable <Person> matchingContacts = PersonRepository.FindContactByName(firstName, lastName, persons);

            IQueryable <Employee> query = from emp in employees
                                          from contact in matchingContacts
                                          where emp.PersonDetails.BusinessEntityID == contact.BusinessEntityID
                                          orderby emp.PersonDetails.LastName
                                          select emp;

            return(query);
        }