public TimeSpentViewModel EmptyViewModel(DayOfWeek dayOfWeek, WeekDTO week) { return(new TimeSpentViewModel() { Date = week.GetDateFor(dayOfWeek), Hours = 0 }); }
private TimeSpentViewModel MapToViewModel(WeekDTO week, DayOfWeek dayOfWeek, IEnumerable <TimeEntryBaseDTO> allEntriesThisWeek) { var thisDaysEntry = allEntriesThisWeek.SingleOrDefault(x => x.Date.DayOfWeek == dayOfWeek); var date = week.GetDateFor(dayOfWeek); return(new TimeSpentViewModel() { DayOfWeek = dayOfWeek, Date = date, Hours = thisDaysEntry?.Hours ?? 0, OvertimeHours = thisDaysEntry?.OvertimeHours ?? 0, }); }