public static ProductCategoryEditModel Create(IRepository <ProductCategory> ProductCategoryRepository) { var productCategoryEdit = new ProductCategoryEditModel { ProductCategory = new ProductCategory(), ProductCategorys = ProductCategoryRepository.GetAll().OrderBy(r => r.Name).ToList(), }; return(productCategoryEdit); }
public static ProductCategoryEditModel GetById(IRepository <ProductCategory> ProductCategoryRepository, int id) { var productcategory = ProductCategoryRepository.GetByID(id); if (productcategory != null) { var model = new ProductCategoryEditModel { ProductCategory = productcategory, ProductCategorys = ProductCategoryRepository.GetAll().OrderBy(r => r.ID).ToList() }; return(model); } return(null); }