using System.Collections.Generic; using System.Linq; using BS.Shared.DataContracts; using System; namespace BeWo.ViewModel.ListViewModel { public class AssessmentSheetEntryListVM : AbstractDCListMapperVM { //public AssessmentSheetEntryListVM(List pDCs, List assessmentSheetCategories, List serviceRecordsInMonth) : base(pDCs) public AssessmentSheetEntryListVM(List pDCs, List assessmentSheetCategories, DateTime startDate) : base(pDCs) { //this.ServiceRecordsInMonth = serviceRecordsInMonth.Select(i => new ServiceRecordVM(i, null, null, null)).ToList(); StartDate = startDate; this.AssessmentSheetCategories = assessmentSheetCategories; if (this.AssessmentSheetCategories != null) { this.AssessmentSheetCategories.Sort((c1, c2) => { var c = c1.Position.CompareTo(c2.Position); if (c == 0 && c1.Description != null) c = c1.Description.CompareTo(c2.Description); return c; }); } } public DateTime StartDate { get; set; } public List AssessmentSheetCategories { get; set; } public List ServiceRecords { get; set; } public List GetServiceRecordsForDate(DateTime date) { if (ServiceRecords != null) return ServiceRecords.Where(i => i.Date.Value.Date.Equals(date)).ToList(); return new List(); } } }