public static TimesheetWeekViewModel ToViewModel(TimesheetWeek timesheet)
        {
            var viewModel = new TimesheetWeekViewModel()
            {
                Notes                    = timesheet.Notes,
                Status                   = timesheet.Status,
                Reference                = timesheet.Reference,
                WeekEnding               = timesheet.WeekEnding,
                CarerID                  = timesheet.CarerID,
                AgreementID              = timesheet.AgreementID,
                CarerPaymentGenerated    = timesheet.CarerPaymentGenerated,
                CreatedDate              = timesheet.CreatedDate,
                CustomerPaymentGenerated = timesheet.CustomerPaymentGenerated,
                ID = timesheet.ID,
                TimesheetStatusID = timesheet.TimesheetStatusID,
                SubmittedBy       = timesheet.SubmittedBy,
                SubmittedDate     = timesheet.SubmittedDate,
                Days = new List <TimesheetDayViewModel>()
            };

            foreach (TimesheetDay day in timesheet.Days)
            {
                viewModel.Days.Add(TimesheetDayViewModel.ToViewModel(day));
            }

            return(viewModel);
        }
        public static TimesheetDayViewModel ToViewModel(TimesheetDay timesheetDay)
        {
            var viewModel = new TimesheetDayViewModel()
            {
                CreatedDate     = timesheetDay.CreatedDate,
                ID              = timesheetDay.ID,
                Date            = timesheetDay.Date,
                Notes           = timesheetDay.Notes,
                TimesheetWeekID = timesheetDay.TimesheetWeekID,
                Periods         = new List <TimesheetPeriodViewModel>()
            };

            foreach (TimesheetPeriod period in timesheetDay.Periods)
            {
                viewModel.Periods.Add(TimesheetPeriodViewModel.ToViewModel(period));
            }
            return(viewModel);
        }