public AnnualLeaveRequestOverviewViewModel GetRequestsForYear(int selectedYear) { var annualLeaveRequestsForYear = _annualLeaveRequestDataAccess.GetRequestsForYear(selectedYear); if (annualLeaveRequestsForYear == null || annualLeaveRequestsForYear.Count == 0) { return(null); } var lastAnnualeaveRequestForYear = annualLeaveRequestsForYear.OrderBy(x => x.StartDate).Last(); annualLeaveRequestsForYear.RemoveAll(x => x.AnnualLeaveRequestID == 0); return(new AnnualLeaveRequestOverviewViewModel() { SelectedYear = selectedYear, AnnualLeaveRequestsForYear = annualLeaveRequestsForYear, AnnualLeaveRequestOverviewForYear = lastAnnualeaveRequestForYear, Years = GetYears(), EditableYearSelected = selectedYear >= DateTime.UtcNow.Year, }); }
public List <AnnualLeaveRequestOverviewModel> GetRequestsForYear(int year) { return(_annualLeaveRequestDataAccess.GetRequestsForYear(year)); }