[HttpPost("/employees/files")] //localhost:123/employees/files public ActionResult AddEmployeesFiles([FromBody] EmployeesWithDate employeesWithDate) { employeesWithDate.Date = employeesWithDate.Date.LocalFromUtc(); var fileService = new FileService(); fileService.SaveEmployeesAsCsv(employeesWithDate); return(new EmptyResult()); }
public void SaveEmployeesAsCsv(EmployeesWithDate employeesWithDate) { var content = GetEmployeesAsCsvContent(employeesWithDate.Employees); File.WriteAllText(GetFileNameByDate(employeesWithDate.Date, ".csv"), content); }