public IPresentableSet<SpikeRhinoSecurity.Domain.Product> Search(string productName, Category category) { IQueryable<SpikeRhinoSecurity.Domain.Product> queryable = _northwind.GetCurrentSession().Linq<SpikeRhinoSecurity.Domain.Product>(); if (productName != default(string)) { queryable = queryable.Where(x => x.ProductName.StartsWith(productName)); } if (category != null) { queryable = queryable.Where(x => x.Category == category); } ((INHibernateQueryable)queryable).QueryOptions.RegisterCustomAction(x => ServiceLocator.Current.GetInstance<IAuthorizationService>().AddPermissionsToQuery(ServiceLocator.Current.GetInstance<IUser>(), "/Category/Read", x)); return new SpikeRhinoSecurity.Infrastructure.QueryablePresentableSet<SpikeRhinoSecurity.Domain.Product>(queryable); }
public virtual bool Equals(Category other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; if (CategoryId != default(int)) { return other.CategoryId == CategoryId; } return other.CategoryId == CategoryId && other.CategoryName == CategoryName && other.Description == Description && other.Picture == Picture && 1 == 1; }