1.var Empdutyleft = _service.GetAllEmployeeDuty().OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.First()).Where(x => x.ToSector_Id == sectorId).ToList(); 2. var EmpStatus = _service.GetEmployeeStatusBySector_Id(sectorId).OrderByDescending(x => x.EndDate) .GroupBy(x => x.Employee_Id).Select(x => x.First()).ToList();