public static DailyAttendanceViewModel Empty(Date date) { var emptyItem = new DailyAttendanceViewModel(); emptyItem.Day = date.Day.ToString(); emptyItem.EditPageUrl = CreateEditPageUrl(date); emptyItem.DayOfWeek = date.Value.ToString("ddd"); return(emptyItem); }
public static DailyAttendanceViewModel FromEntity(DailyAttendance attendance) { var item = new DailyAttendanceViewModel(); item.Day = attendance.Date.Day.ToString(); item.EditPageUrl = CreateEditPageUrl(attendance.Date); item.DayOfWeek = attendance.Date.Value.ToString("ddd"); if (attendance.Category == Domains.Category.Attendance) { item.StartTime = attendance.StartTime.value.ToString("HH:mm"); item.EndTime = attendance.EndTime.value.ToString("HH:mm"); item.ActualWorkHours = attendance.ActualWorkTimeSpan.ToString(@"hh\:mm"); } else { item.Category = attendance.Category.ToString(); } return(item); }