public MpChildcareRequestDate GetChildcareRequestDates(int childcareRequestId, DateTime date, string token) { var apiToken = _apiUserService.GetToken(); var searchString = String.Format("{0},", childcareRequestId); var mpRecords = _ministryPlatformService.GetRecordsDict(_childcareRequestDatesPageId, apiToken, searchString); var requestedDate = new MpChildcareRequestDate(); foreach (var mpRecord in from mpRecord in mpRecords let mpDate = mpRecord.ToDate("Childcare_Request_Date") where date.Date == mpDate.Date select mpRecord) { requestedDate.RequestDate = mpRecord.ToDate("Childcare_Request_Date"); requestedDate.ChildcareRequestDateId = mpRecord.ToInt("dp_RecordID"); requestedDate.ChildcareRequestId = childcareRequestId; requestedDate.Approved = mpRecord.ToBool("Approved"); } return(requestedDate); }
private MpChildcareRequestDate GetChildcareDateFromList(List <MpChildcareRequestDate> allDates, DateTime date) { var requestedDate = new MpChildcareRequestDate(); return(allDates.SingleOrDefault(d => date.Date == d.RequestDate.Date)); }