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)); }
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)); }
public List <SubCategory> GetAll() { return(_subCategoryDal.GetList()); }