public async Task <ActionResult <IEnumerable <TimesheetItem> > > Export(string from, string to) { var sessionData = _sessionService.GetSession(HttpContext); if (sessionData == null) { return(Unauthorized()); } DateTime fromDate = DateHelper.ParseDate(from, DateTime.MinValue); DateTime toDate = DateHelper.ParseDate(to, DateTime.MaxValue); var bytes = await _timesheetRepository.ExportHTML(sessionData.UserId, fromDate, toDate); return(new FileStreamResult(new MemoryStream(bytes), "application/html") { FileDownloadName = "export.html" }); }