以下のようなモデル設定があります。
public class ReportScheduleModel
{
public string Day { get; set; }
public List<ReportTimes> reportTimes { get; set; }
}
public class ReportTimes
{
public byte hourOfDay { get; set; }
public byte minuteOfDay { get; set; }
public string reportType { get; set; }
}
次に、次のリスト形式を使用して、リスト全体をコントローラーに渡すことができます。
List<ReportScheduleModel> ReportSchedule
[0]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[1]->hourOfDay: '08'
minuteOfDay: '11'
reportType: 'Test2'
[1]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[1]->hourOfDay: '11'
minuteOfDay: '30'
reportType: 'Test1'
[2]->Day: 'Monday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
上記のリストでReportSchedule[0]
、ReportSchedule[1]
両方の報告時刻が「09:23 Test1」とまったく同じであることがわかります。私がやろうとしているのは、これらの重複した値を持たないリストを取得することです。重複したレポート時間値の 1 つだけを保持します。したがって、上記に基づく私の理想的なフィルタリングされたリストは次のようになりますDay
。ReportTimes
[0]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[1]->hourOfDay: '08'
minuteOfDay: '11'
reportType: 'Test2'
[1]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '11'
minuteOfDay: '30'
reportType: 'Test1'
[2]->Day: 'Monday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'