internal static IEnumerable <ILeaveRequestModel> GetLeaveRequestByHrAdminId(HRMSEntities db, string HrAdminUsername) { // Step 1: Get the company for this HR Admin. var companyInfo = CompanyQueries.getCompanyForHrAdmin(db, HrAdminUsername); // Step 2: Get the leave requests of employees in that company. var leaveRequests = GetLeaveRequestByCompanyId(db, companyInfo.CompanyId); return(leaveRequests); }
internal static IEnumerable <ILeaveRequestModel> GetLeaveRequestByHrAdminIdWithChildCompanies(HRMSEntities db, int HrAdminId) { var hrUser = UserQueries.getUserById(db, HrAdminId); var companyIDsForHr = CompanyQueries.GetCompanyIDsForHRList(db, hrUser.Username); var leaveRequests = new List <ILeaveRequestModel>(); foreach (int companyId in companyIDsForHr) { leaveRequests.AddRange(GetLeaveRequestByCompanyId(db, companyId).ToList()); } return(leaveRequests); }