public async Task <object> GetLoanDonorByUserId(Guid UserId) { try { var result = dataContext.LoanDonors.Where(x => x.UserId == UserId.ToString()).Include(p => p.LoanDonorDocuments).AsQueryable().Select(x => new LoanDonor { DonorAccountName = x.DonorAccountName, DonorAccountNumber = x.DonorAccountNumber, ImpactInvestmentAmount = x.ImpactInvestmentAmount, DonorBank = x.DonorBank, DonorEmail = x.DonorEmail, DonorFirstName = x.DonorFirstName, DonorLastName = x.DonorLastName, DonorLocation = x.DonorLocation, DonorPhoneNumber = x.DonorPhoneNumber, EcoFriendlyPurpose = x.EcoFriendlyPurpose, LoanDonorDocuments = x.LoanDonorDocuments, Options = x.Options, PurposePreferred = x.PurposePreferred, Tenor = x.Tenor, UserId = x.UserId }); var loanDonorList = new LoanDonorListDTO { LoanDonors = result.ToList() }; res.Data = loanDonorList; res.Message = "List of Donors For this user found"; res.Success = true; return(res); } catch (Exception ex) { throw; } }
public async Task <object> GetAllLoanDonor() { try { var result = dataContext.LoanDonors.Select(x => new LoanDonor { DonorAccountName = x.DonorAccountName, DonorAccountNumber = x.DonorAccountNumber, ImpactInvestmentAmount = x.ImpactInvestmentAmount, DonorBank = x.DonorBank, DonorEmail = x.DonorEmail, DonorFirstName = x.DonorFirstName, DonorLastName = x.DonorLastName, DonorLocation = x.DonorLocation, DonorPhoneNumber = x.DonorPhoneNumber, EcoFriendlyPurpose = x.EcoFriendlyPurpose, LoanDonorDocuments = x.LoanDonorDocuments, Options = x.Options, PurposePreferred = x.PurposePreferred, Tenor = x.Tenor }); var LoanDonorList = new LoanDonorListDTO { LoanDonors = result.ToList() }; res.Data = LoanDonorList; res.Message = "List of LoanDonors"; res.Success = true; return(res); } catch (Exception ex) { throw; } }