public async Task <IEnumerable <CategoryViewModel> > GetCategoriesAsync(CategorySearchParams searchParams) { var specification = new CategoryFilterSpecification(searchParams); return(await _categoryRepository.ListAsync <CategoryViewModel>(specification, CategoryHelpers.GetCategoryMapperConfiguration())); }
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); }