все три (Attendance,InTime,OutTime
) взяты из указанной таблицы
Attendence = CheckAttendance.Where(y => y.EmployeeId == x.EmployeeId).Count(),
InTime = CheckAttendance.Where(y => y.EmployeeId == x.EmployeeId).Select(y=>y.StartTime).ToList(),
OutTime = CheckAttendance.Where(y => y.EmployeeId == x.EmployeeId).Select(y=>y.EndTime),
C # API-код
var TentId = objdb.Adminsitrators.Where(x => x.AdminId == AdminId).Select(x => x.TenantID).SingleOrDefault();
var emp = objdb.Employees.Where(x=>x.TenantID== TentId).ToList();
if (emp.Count > 0)
{
var CheckAttendance = objdb.EmpAttendances.Where(x => x.Status == "Present" & x.TenantID==TentId & x.StartTime.Year == StartTime.Year & x.StartTime.Month == StartTime.Month & x.StartTime.Day == StartTime.Day).ToList();
var list = emp.Select(x => new
{
EmpID = x.EmployeeId,
EmpName = x.Name,
EmpImage = "Areas/Admin/Image/" + x.Image,
Configured = fileResult(x.EmployeeId),
Attendence = CheckAttendance.Where(y => y.EmployeeId == x.EmployeeId).Count(),
InTime = CheckAttendance.Where(y => y.EmployeeId == x.EmployeeId).Select(y=>y.StartTime).ToList(),
OutTime = CheckAttendance.Where(y => y.EmployeeId == x.EmployeeId).Select(y=>y.EndTime),
}).ToList();
Value["result"] = "TRUE";
Value["Data"] = list;
}
JSON результат
"result": "TRUE",
"Data": [
{
"EmpID": 14,
"EmpName": "Arun Kumar",
"EmpImage": "Areas/Admin/Image/EmployeeImg_55991775.JPG",
"Configured": 0,
"Attendence": 1, //Count Data
"InTime": [
"2019-05-21T16:13:18.873" //Tolist
],
"OutTime": [
"2019-05-21T16:12:51.967" //Select
]
},