Ejemplo n.º 1
0
 public async Task <IActionResult> Export(int id)
 {
     using (var dbContext = new BettenContext())
     {
         ExcelExporter excelExporter = new ExcelExporter(dbContext, id);
         var           evt           = dbContext.Events.First(e => e.Id == id);
         return(File(
                    await excelExporter.Export(),
                    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                    $"{evt.Title} {evt.Date}.xlsx"));
     }
 }
Ejemplo n.º 2
0
 public ExcelExporter(BettenContext dbContext, int eventId)
 {
     this.dbContext = dbContext;
     this.eventId   = eventId;
     Console.WriteLine(eventId);
 }