public static string GetTimeInOutString(string id, IAttendanceService _attendanceService, int type, DateTime time) { var result = type == 1 ? GetAttendanceNowByUserID(id, _attendanceService, time).TimeIn : GetAttendanceNowByUserID(id, _attendanceService, time).TimeOut; if (result != null) { var extra = TimeCalculator.IdentifyMeridiem(result.Value.Hours); var hour = result.Value.Hours > 12 ? result.Value.Hours - 12 : result.Value.Hours; return(hour + ":" + result.Value.Minutes + " " + extra); } return(null); }