static void Main(string[] args) { Parser.Default.ParseArguments <Options>(args).WithParsed(o => { Console.WriteLine("Running salary calculator with parameters:"); Console.WriteLine($"File path: {o.FilePath}"); Console.WriteLine($"Salary date: {o.SalaryDate.ToShortDateString()}"); Console.WriteLine("---------------------------------------------------------"); if (!File.Exists(o.FilePath)) { Console.WriteLine($"File {o.FilePath} is missing."); return; } var provider = new EmployeeProvider(new FileJsonEmployeeDataProvider(o.FilePath)); var employees = provider.GetEmployees(); Console.WriteLine($"Company with {employees.Count()} persons was loaded:"); foreach (var person in employees) { Console.WriteLine($"{person.Name} with salary {person.GetSalaryByDate(o.SalaryDate)}"); } Console.WriteLine($"Total: {employees.Sum(e => e.GetSalaryByDate(o.SalaryDate))}"); }); }
public ActionResult GetEmployees() { var employee = employeeProvider.GetEmployees(); return(View(employee)); }