public async Task <(int, IReadOnlyList <Scheduler>)> GetSchedulers(int campaignId, int userProfileId, CommonSpecParams specParams) { var specGetScheduler = new GetSchedulerSpecification(specParams, campaignId, userProfileId); var schedulers = await _unitOfWork.Repository <Scheduler>().ListAsync(specGetScheduler); var specSchedulerCount = new GetSchedulerCountSpecification(specParams, campaignId, userProfileId); var count = await _unitOfWork.Repository <Scheduler>().CountAsync(specSchedulerCount); return(count, schedulers); }
public async Task <(int, IReadOnlyList <Scheduler>, Campaign, Content)> GetSchedulers(Guid userId, CommonSpecParams specParams) { var userProfile = await _userProfileService.GetUserProfileByUserId(userId); var campaignAssignment = await _campaignAssignmentService.GetActiveCampaignAssignment(userProfile.id); if (campaignAssignment == null) { return(0, null, null, null); } var specGetScheduler = new GetSchedulerSpecification(specParams, campaignAssignment.CampaignId, campaignAssignment.UserProfileId); var schedulers = await _unitOfWork.Repository <Scheduler>().ListAsync(specGetScheduler); var campaign = campaignAssignment.Campaign; var content = await _contentService.GetContentByCampaignId(campaign.id); var specSchedulerCount = new GetSchedulerCountSpecification(specParams, campaignAssignment.CampaignId, campaignAssignment.UserProfileId); var count = await _unitOfWork.Repository <Scheduler>().CountAsync(specSchedulerCount); return(count, schedulers, campaign, content); }