public ActionResult GetAll() { using (var unit = GetUnitOfWork()) { var repo = new ProductModelRepository(unit, _defaultVendorID); var types = unit.Service <Product>().GetAll(c => _vendorIDs.Any(x => x == c.SourceVendorID) && c.IsConfigurable) .Select(c => c.VendorItemNumber) .ToList() .Select(c => c.Split(new char[] { '-' }).Try(l => l[0], string.Empty)) .Distinct() .ToList(); var filledIn = repo.GetAll(); return(List((from p in types where !string.IsNullOrEmpty(p) let existing = filledIn.FirstOrDefault(c => c.ModelCode == p) select new ModelDescriptionModel() { ModelCode = p, Translation = existing == null ? string.Empty : existing.Translation }).AsQueryable())); } }
public Product GetProduct(Product product) { IRepositoryBase <ProductCategory> repositoryCategory = new ProductCategoryRepository(); product.ProductCategoryCollection = repositoryCategory.GetAll().ToList(); IRepositoryBase <ProductSubCategory> repositorySubCategory = new ProductSubCategoryRepository(); product.ProductSubCategoryCollection = repositorySubCategory.GetAll().ToList(); IRepositoryBase <ProductModel> repositoryProductModel = new ProductModelRepository(); product.ProductModelCollection = repositoryProductModel.GetAll().ToList(); return(product); }
public ProviderQuery(ProductRepository productRepository, ProductModelRepository productModelRepository) { Field <ListGraphType <ProductType> >( "products", arguments: new QueryArguments(new QueryArgument <IdGraphType> { Name = "id" }), resolve: context => { var _productId = context.GetArgument <int?>("id"); return(_productId == null ? productRepository.GetAll() : productRepository.GetById(_productId.Value)); }); Field <ListGraphType <ProductModelType> >( "productModels", arguments: new QueryArguments(new QueryArgument <IdGraphType> { Name = "id" }), resolve: context => { var _productModelId = context.GetArgument <int?>("id"); return(_productModelId == null ? productModelRepository.GetAll() : productModelRepository.GetById(_productModelId.Value)); }); }
public List <ProductModel> GetAll() { var var = _Repository.GetAll(); return(var); }