namespace Aufgabe11 { public class SalesRepresentativeRepository { public List<(string FirstName, string LastName, string Company, decimal SalesVolume)> GetSalesRepsFromBadenWuerttemberg(List salesRepresentatives) { if (salesRepresentatives != null) { var results = from representative in salesRepresentatives where representative.Area == "Baden-Württemberg" orderby representative.Company select (FirstName: representative.FirstName, LastName: representative.LastName, Company: representative.Company, SalesVolume: representative.SalesVolume); return results.ToList(); } else { return new List<(string FirstName, string LastName, string Company, decimal SalesVolume)>(); } } public List GetSalesRepsFromBadenWuerttembergNew(List salesRepresentatives) { if (salesRepresentatives != null) { var results = from representative in salesRepresentatives where representative.Area == "Baden-Württemberg" orderby representative.Company select representative; return results.ToList(); } else { return new List(); } } public List<(string FirstName, string LastName, string Company, string Area, decimal SalesVolume)> GetSalesRepsGroupedByCompany(List salesRepresentatives) { if (salesRepresentatives != null) { var results = from representative in salesRepresentatives where representative.SalesVolume >= 10000 orderby representative.Company, representative.SalesVolume descending select (FirstName: representative.FirstName, LastName: representative.LastName, Company: representative.Company, Area: representative.Area, SalesVolume: representative.SalesVolume); return results.ToList(); } else { return new List<(string FirstName, string LastName, string Company, string Area, decimal SalesVolume)>(); } } public List GetSalesRepsGroupedByCompanyNew(List salesRepresentatives) { if (salesRepresentatives != null) { var results = from representative in salesRepresentatives where representative.SalesVolume >= 10000 orderby representative.Company, representative.SalesVolume descending select representative; return results.ToList(); } else { return new List(); } } public List<(string FirstName, string LastName, string Company, string Area, decimal SalesVolume)> GetTopTenLosers(List salesRepresentatives) { if (salesRepresentatives != null) { var results = from representative in salesRepresentatives orderby representative.SalesVolume select (FirstName: representative.FirstName, LastName: representative.LastName, Company: representative.Company, Area: representative.Area, SalesVolume: representative.SalesVolume); results = results.Take(10); return results.ToList(); } else { return new List<(string FirstName, string LastName, string Company, string Area, decimal SalesVolume)>(); } } public List GetTopTenLosersNew(List salesRepresentatives) { if (salesRepresentatives != null) { var results = salesRepresentatives .OrderBy(representative => representative.SalesVolume) .Take(10) .ToList(); return results; } else { return new List(); } } } }