예제 #1
0
        public async Task <IEnumerable <CategoryViewModel> > GetCategoriesAsync(CategorySearchParams searchParams)
        {
            var specification = new CategoryFilterSpecification(searchParams);

            return(await _categoryRepository.ListAsync <CategoryViewModel>(specification,
                                                                           CategoryHelpers.GetCategoryMapperConfiguration()));
        }
예제 #2
0
        public async Task <CategoryViewModel> GetCategoryByNameAsync(string categoryName)
        {
            var category = await _categoryRepository.GetByConditionAsync <CategoryViewModel>(x => x.Name == categoryName,
                                                                                             CategoryHelpers.GetCategoryMapperConfiguration());

            Guard.Against.NullItem(category, nameof(category));

            return(category);
        }