Exemplo n.º 1
0
        public FilteredPhotoSpecification(PhotoOrders order, string name, string description)
        {
            switch (order)
            {
            case PhotoOrders.Name:
                Query.OrderBy(p => p.Name);
                break;

            case PhotoOrders.Created:
                Query.OrderByDescending(p => p.Created);
                break;

            case PhotoOrders.Type:
                Query.OrderBy(p => p.File.FileType);
                break;
            }

            if (!string.IsNullOrEmpty(name))
            {
                Query.Where(p => p.Name.Contains(name.ToLower()));
            }

            if (!string.IsNullOrEmpty(description))
            {
                Query.Where(p => p.Description.Contains(description.ToLower()));
            }
        }
 public FilteredPagedPhotoSpecification(PhotoOrders order, int limit, int offset, string name, string description)
     : base(order, name, description)
 {
     Query.Paginate(offset, limit);
 }