public IHttpActionResult GetTimeEntriesByUser( [FromUri] string UserScope, [FromUri] int[] UserIds, [FromUri] string JobScope, [FromUri] int[] JobIds, [FromUri] DateTime Min, [FromUri] DateTime Max) { var currentUser = CurrentUser(); telemetryClient.TrackTrace($"Generating TimeEntriesByUser report for {Min:G} through {Max:G}"); // Ensure that user is authorized. if (!currentUser.CanViewReports) { return(StatusCode(HttpStatusCode.Forbidden)); } var bytes = new TimeCardsByUserAsExcel().Build(currentUser, Min, Max, UserScope, UserIds, JobScope, JobIds); return(new FileActionResult( bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"Report - Time Cards by User {Min.ToString("yyyy_MM_dd")} thru {Max.ToString("yyyy_MM_dd")}.xlsx", Request)); }
public IActionResult GetTimeEntriesByUser( [FromQuery] string UserScope, [FromQuery] int[] UserIds, [FromQuery] string JobScope, [FromQuery] int[] JobIds, [FromQuery] DateTime Min, [FromQuery] DateTime Max) { var currentUser = CurrentUser(); _telemetryClient.TrackTrace($"Generating TimeEntriesByUser report for {Min:G} through {Max:G}"); // Ensure that user is authorized. if (!currentUser.CanViewReports) { return(Forbid()); } var bytes = new TimeCardsByUserAsExcel().Build(_context, currentUser, Min, Max, UserScope, UserIds, JobScope, JobIds); return(File( bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileDownloadName: $"Report - Time Cards by User {Min.ToString("yyyy_MM_dd")} thru {Max.ToString("yyyy_MM_dd")}.xlsx")); }