public FileStreamResult SampleAsPdf() { var filename = "sample.pdf"; var uri = new Uri(Url.Action("Sample", "Pdf"), UriKind.Relative); var result = _pdfService.GeneratePdf(uri, filename, null); return(result); }
public Invoice CreateNewInvoice(int[] studentIds, DateTime?startDate, DateTime?endDate, string userId) { DateTime start = startDate ?? new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); DateTime end = endDate ?? DateTime.Now; IList <Lesson> lessons = LessonsRepository.GetLessons(studentIds, start, end, int.Parse(userId)); Invoice invoice = InvoiceRepository.CreateNewInvoice(new Invoice() { StartDate = new DateTime(start.Year, start.Month, start.Day, 0, 0, 0), EndDate = new DateTime(end.Year, end.Month, end.Day, 23, 59, 59), UserId = int.Parse(userId), Total = lessons.Sum(lesson => (decimal)lesson.Duration * (decimal)lesson.Student.FeePayable), CreatedDate = DateTime.Now, Lessons = lessons }, studentIds); var invoiceHtml = HandlebarsService.InvoiceToHtml(invoice, Template.InvoiceTemplate1); var invoiceUrl = PdfService.GeneratePdf(invoiceHtml); invoice.InvoiceUrl = invoiceUrl; return(invoice); }
public EmployeePdfModel GetEmployeePdf(Guid id) { var user = Get(id); return(_pdfService.GeneratePdf(user)); }