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); }
public CategoryService() { _categoryRepo = new CategoryRepo(); _productService = new ProductService(); }