private void EmployeeMenuFilteredByFunction() { string choice = MenuUtils.GetString("Function"); PrintFromDb <Employee>((EmployeeContext db) => { return(db.Employees.AsNoTracking().Where(x => x.Function.Contains(choice)).ToList()); }); SalaryChargeMenu((EmployeeContext db) => { return(db.Employees.Where(x => x.Function.Contains(choice)).Sum(x => x.Salary)); }, EmployeeMenuFiltered); }