Пример #1
0
        public static ProductCategoryEditModel Create(IRepository <ProductCategory> ProductCategoryRepository)
        {
            var productCategoryEdit = new ProductCategoryEditModel
            {
                ProductCategory  = new ProductCategory(),
                ProductCategorys = ProductCategoryRepository.GetAll().OrderBy(r => r.Name).ToList(),
            };

            return(productCategoryEdit);
        }
Пример #2
0
        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);
        }