public CategorySelectController(ICategoryRepository categoryRepository, IAttributeDetailRepository attributeListRepository) { _categoryRepository = categoryRepository; _attributeListRepository = attributeListRepository; _attribute = new CategoryAttributes(); _categoryItem = new Category(); _attributes = new List <AttributeDetail>(); _category = new List <Category>(); }
public IEnumerable <Category> GetCategories() { _categories = _categoryRepository.GetAll().ToList(); _categoryViews = _category.ToList(); foreach (var category in _categories) { _categoryItem.Icon = category.Icon; _categoryItem.Id = category.Id; _categoryItem.Name = category.Name; _categoryViews.Add(_categoryItem); _categoryItem = new Category(); } return(_categoryViews); }