Ejemplo n.º 1
0
        public async Task <IEnumerable <CategoryViewModel> > GetCategoriesAsync(CategorySearchParams searchParams)
        {
            var specification = new CategoryFilterSpecification(searchParams);

            return(await _categoryRepository.ListAsync <CategoryViewModel>(specification,
                                                                           CategoryHelpers.GetCategoryMapperConfiguration()));
        }
Ejemplo n.º 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);
        }