public IEnumerable <OffendingCustomersReport> GetOffendingCustomersReport(DateTime?fromDate, DateTime?untilDate, int?complaintType) { var complaintsGrouping = _complaintsQueryProcessor.Search(null, fromDate, untilDate, complaintType).GroupBy(x => x.OffendingCustomer.Id, x => x.OffendedCustomer.Id); List <OffendingCustomersReport> offendingList = new List <OffendingCustomersReport>(); foreach (var item in complaintsGrouping) { DTOs.Customer customer = _customersQueryProcessor.GetCustomer(item.Key ?? 0); offendingList.Add(new OffendingCustomersReport() { CustomerId = customer.Id ?? 0, FirstName = customer.FirstName, LastName = customer.LastName, NumberOfComplaints = item.Count() }); } return(offendingList); }
public DTOs.Customer Get(int id) { return(_customersQueryProcessor.GetCustomer(id)); }