コード例 #1
0
        private IQueryable <Contact> QueryContacts(Filters.ContactFilterOptions options, PagingSettings paging = null)
        {
            var contacts = Context.Contact.Include("Company").Where(q => !q.Deleted.HasValue);

            if (options != null)
            {
                if (options.Type.HasValue)
                {
                    contacts = contacts.Where(c => c.Type == options.Type);
                }
            }

            if (options != null)
            {
                if (options.Order == "desc")
                {
                    contacts = contacts.OrderByDescending(x => (x.FirstName + x.CompanyName));
                }
                else
                {
                    contacts = contacts.OrderBy(x => (x.FirstName + x.CompanyName));
                }
            }
            else
            {
                contacts = contacts.OrderBy(x => (x.FirstName + x.CompanyName));
            }


            if (paging != null)
            {
                contacts = contacts.Distinct().OrderByDescending(l => l.CreatedDate).ToPagedQueryable(paging);
            }
            return(contacts);
        }
コード例 #2
0
 public int Total(Filters.ContactFilterOptions options)
 {
     return(Repository.Total(options));
 }
コード例 #3
0
 public List <Contact> GetAll(Filters.ContactFilterOptions options = null, PagingSettings paging = null)
 {
     return(Repository.GetAll(options, paging));
 }
コード例 #4
0
        public List <Contact> GetAll(Filters.ContactFilterOptions options = null, PagingSettings paging = null)
        {
            IQueryable <Contact> contacts = QueryContacts(options, paging);

            return(contacts.ToList());
        }
コード例 #5
0
 public int Total(Filters.ContactFilterOptions options)
 {
     return(QueryContacts(options).Count());
 }