public async Task <CommunityViewModel> GetCommunityByNameAsync(string communityName) { var community = await _communityRepository.GetByConditionAsync <CommunityViewModel>( x => x.Name == communityName, CommunityHelpers.GetCommunityMapperConfiguration()); Guard.Against.NullItem(community, nameof(community)); return(community); }
public async Task <IEnumerable <CommunityViewModel> > GetCommunitiesAsync(CommunitySearchParams searchParams) { User user = await _userManager.FindByIdAsync(searchParams.UserId); Guard.Against.NullItem(user, nameof(user)); var specification = new CommunityFilterSpecification(searchParams); return(await _communityRepository.ListAsync <CommunityViewModel>(specification, CommunityHelpers.GetCommunityMapperConfiguration())); }