Пример #1
0
        public Category GetCategory(string inputFromUser)
        {
            CategoryRepo categoryRepo = new CategoryRepo();
            Category     returned     = new Category();
            int          categoryID   = 0;

            if (Int32.TryParse(inputFromUser, out categoryID))
            {
                returned = categoryRepo.GetCategoryByID(categoryID);
            }
            else
            {
                if (_categoryRepo.validateCategory(inputFromUser))
                {
                    returned = categoryRepo.GetCategoryByName(inputFromUser);
                }
                else
                {
                    Console.WriteLine("-->Category not in the List");
                }
            }
            return(returned);
        }
Пример #2
0
 public CategoryService()
 {
     _categoryRepo   = new CategoryRepo();
     _productService = new ProductService();
 }