public IDataResult <List <SubCategory> > GetAll()
        {
            var result = _subCategoryDal.GetList();

            if (result == null)
            {
                return(new ErrorDataResult <List <SubCategory> >(Messages.SubCategoriesNotFound));
            }
            return(new SuccessDataResult <List <SubCategory> >(result));
        }
示例#2
0
        public IDataResult <List <Category> > GetSubCategories(int categoryId)
        {
            if (IsEndCategory(categoryId))
            {
                return(new ErrorDataResult <List <Category> >(Messages.ThereIsntSubCategory));
            }

            var             subCategories = _subCategoryDal.GetList(sc => sc.CategoryId == categoryId);
            List <Category> categories    = new List <Category>();

            foreach (var subCategory in subCategories)
            {
                categories.Add(_categoryDal.Get(c => c.CategoryId == subCategory.SubCategoryId));
            }
            return(new SuccessDataResult <List <Category> >(categories));
        }
示例#3
0
 public List <SubCategory> GetAll()
 {
     return(_subCategoryDal.GetList());
 }