public async Task <IEnumerable <DonationResponseDto> > GetAllDonation(Expression <Func <Donation, bool> > predicate) { IQueryable <Donation> donation = DonationRepository.GetWhereAsQueryable(predicate).Include(d => d.CharitableEntity).Include(d => d.DonationItem).OrderByDescending(g => g.Date); IEnumerable <DonationResponseDto> donationResponse = this.Mapper.Map <IEnumerable <DonationResponseDto> >(await donation.ToListAsync()); return(donationResponse); }
public async Task <PagedResponse <DonationResponseDto> > GetAllDonation(Expression <Func <Donation, bool> > predicate, PaginationParams paginationParams) { IQueryable <Donation> donation = DonationRepository.GetWhereAsQueryable(predicate).Include(d => d.CharitableEntity).Include(d => d.DonationItem).OrderByDescending(g => g.Date); PagedResponse <DonationResponseDto> pagedResponse = new PagedResponse <DonationResponseDto>(); pagedResponse = await pagedResponse.ToPagedResponse(donation, paginationParams, this.Mapper.Map <IEnumerable <DonationResponseDto> >); return(pagedResponse); }
public async Task <bool> ExistDonation(Expression <Func <Donation, bool> > predicate) { List <Donation> lstDonation = null; var query = DonationRepository.GetWhereAsQueryable(predicate); lstDonation = await query.ToListAsync(); var donation = lstDonation.FirstOrDefault(); if (donation == null) { return(false); } return(true); }
public async Task <DonationResponseDto> GetDonation(Expression <Func <Donation, bool> > predicate) { List <Donation> lstDonation = null; var query = DonationRepository.GetWhereAsQueryable(predicate); lstDonation = await query.ToListAsync(); var donation = lstDonation.FirstOrDefault(); if (donation == null) { return(null); } var donationDto = this.Mapper.Map <DonationResponseDto>(donation); return(donationDto); }