public IActionResult DownloadEndOfDayReport([FromBody] NewEndOfDayModel newEndOfDay) { try { var endOfDayClass = new EndOfDayClass(); var _ = DateTime.TryParseExact(newEndOfDay.ReportForDate, "yyyy-MM-dd", null, DateTimeStyles.None, out var reportDate); var endOfDayModel = new EndOfDayModel { DateRequested = reportDate, OrderType = newEndOfDay.OrderType, ReportType = newEndOfDay.ReportType }; var endOfDayPdf = endOfDayClass.GenerateEndOfDayDownload(endOfDayModel); var path = $"{Guid.NewGuid()}.pdf"; endOfDayPdf.SaveAs(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", path)); var json = JsonSerializer.Serialize(path, new JsonSerializerOptions() { IgnoreNullValues = true }); return(Ok(json)); } catch (Exception exception) { return(StatusCode(500, exception.Message)); } }
public IActionResult MarkEndOfDayReportFileAsPrinted(int id) { try { var endOfDayClass = new EndOfDayClass(); var getModel = endOfDayClass.MarkAsPrinted(id); var json = JsonSerializer.Serialize(getModel, new JsonSerializerOptions() { IgnoreNullValues = true }); return(Ok(json)); } catch (Exception exception) { return(StatusCode(500, exception.Message)); } }