Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions EstateReportingAPI.BusinessLogic/ReportingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,7 @@ public async Task<Result<Merchant>> GetMerchant(MerchantQueries.GetMerchantQuery
var merchantQuery = context.Merchants.Select(m => new {
MerchantReportingId = m.MerchantReportingId,
Name = m.Name,
LastSaleDateTime = m.LastSaleDateTime,
LastSale = m.LastSaleDate,
CreatedDateTime = m.CreatedDateTime,
LastStatement = m.LastStatementGenerated,
MerchantId = m.MerchantId,
Reference = m.Reference,
m.SettlementSchedule,
Expand All @@ -1005,10 +1002,8 @@ public async Task<Result<Merchant>> GetMerchant(MerchantQueries.GetMerchantQuery
ma.PostalCode,
ma.Region,
ma.Town
// Add more properties as needed
}).FirstOrDefault(), // Get the first matching MerchantAddress or null
ContactInfo = context.MerchantContacts.Where(mc => mc.MerchantId == m.MerchantId).OrderByDescending(mc => mc.CreatedDateTime).Select(mc => new { mc.ContactId, mc.Name, mc.EmailAddress, mc.PhoneNumber }).FirstOrDefault(), // Get the first matching MerchantContact or null
EstateReportingId = context.Estates.Single(e => e.EstateId == m.EstateId).EstateReportingId
}).FirstOrDefault(),
ContactInfo = context.MerchantContacts.Where(mc => mc.MerchantId == m.MerchantId).OrderByDescending(mc => mc.CreatedDateTime).Select(mc => new { mc.ContactId, mc.Name, mc.EmailAddress, mc.PhoneNumber }).FirstOrDefault()
}).Where(m => m.MerchantId == request.MerchantId);

var merchantQueryResult = await ExecuteQuerySafeSingleOrDefault(merchantQuery, cancellationToken, "Error getting merchant");
Expand Down
Loading