public IEnumerable<DalRole> GetByPredicate(Expression<Func<DalRole, bool>> f) { var modifier = new ParameterExpressionModifier<DalRole, Role>(Expression.Parameter(typeof(Role), f.Parameters[0].Name)); var expression = Expression.Lambda<Func<Role, bool>>(modifier.Visit(f.Body), modifier.NewParameterExpr); return context.Set<Role>().Where(expression).Select(ormrole => new DalRole() { Id = ormrole.Id, Name = ormrole.Name }); }
public IEnumerable<DalProduct> GetByPredicate(Expression<Func<DalProduct, bool>> f) { var modifier = new ParameterExpressionModifier<DalProduct, Product>(Expression.Parameter(typeof(Product), f.Parameters[0].Name)); var expression = Expression.Lambda<Func<Product, bool>>(modifier.Visit(f.Body), modifier.NewParameterExpr); return context.Set<Product>().Where(expression).Select(ormproduct => new DalProduct() { Id = ormproduct.Id, Auction_Cost = ormproduct.Auction_Cost, AuctionStart = ormproduct.AuctionStart, AuctionEnd = ormproduct.AuctionEnd, Seller_Id = ormproduct.Seller_Id, Customer_Id = ormproduct.Customer_Id, Description = ormproduct.Description }); }
public IEnumerable<DalUser> GetByPredicate(Expression<Func<DalUser, bool>> f) { var modifier = new ParameterExpressionModifier<DalUser, User>(Expression.Parameter(typeof(User), f.Parameters[0].Name)); var expression = Expression.Lambda<Func<User, bool>>(modifier.Visit(f.Body), modifier.NewParameterExpr); return context.Set<User>().Where(expression).Select(ormuser => new DalUser() { Id = ormuser.Id, Login = ormuser.Login, E_mail = ormuser.E_mail, Password = ormuser.Password, Role_Id = ormuser.Role_Id, RegistryDate = ormuser.RegistryDate, SoldProducts = ormuser.SoldProducts.Select(product => new DalProduct() { Id = product.Id, Auction_Cost = product.Auction_Cost, AuctionStart = product.AuctionStart, AuctionEnd = product.AuctionEnd, Seller_Id = product.Seller_Id, Customer_Id = product.Customer_Id, Description = product.Description }).ToList(), BoughtProducts = ormuser.BoughtProducts.Select(product => new DalProduct() { Id = product.Id, Auction_Cost = product.Auction_Cost, AuctionStart = product.AuctionStart, AuctionEnd = product.AuctionEnd, Seller_Id = product.Seller_Id, Customer_Id = product.Customer_Id, Description = product.Description }).ToList() }); }
public IEnumerable<RoleEntity> GetByPredicate(Expression<Func<RoleEntity, bool>> p) { var modifier = new ParameterExpressionModifier<RoleEntity, DalRole>(Expression.Parameter(typeof(DalRole), p.Parameters[0].Name)); var expression = Expression.Lambda<Func<DalRole, bool>>(modifier.Visit(p.Body), modifier.NewParameterExpr); return roleRepository.GetByPredicate(expression).Select(role => role.ToBllRole()); }
public IEnumerable<ProductEntity> GetByPredicate(Expression<Func<ProductEntity, bool>> p) { var modifier = new ParameterExpressionModifier<ProductEntity, DalProduct>(Expression.Parameter(typeof(DalProduct), p.Parameters[0].Name)); var expression = Expression.Lambda<Func<DalProduct, bool>>(modifier.Visit(p.Body), modifier.NewParameterExpr); return productRepository.GetByPredicate(expression).Select(product => product.ToBllProduct()); }