Exemplo n.º 1
0
        /// <summary>
        /// Zapisuje na dysku twardym odpis aktu zgonu.
        /// </summary>
        /// <param name="model">Model dokumentu aktu.</param>
        public void SaveDeathCert(Entry model)
        {
            DocumentEntry docEntry = new DocumentEntry(model);

            MemoryStream file = PdfGenerator.CreatePdf(2, docEntry);

            SaveCert(file);
        }
Exemplo n.º 2
0
        public async override Task WriteToStreamAsync(
            Type type,
            object value,
            Stream writeStream,
            HttpContent content,
            TransportContext transportContext)
        {
            var doc = PdfGenerator.CreatePdf(value == null ? null : value as T);

            using (var ms = new MemoryStream())
            {
                doc.Save(ms, false);
                var bytes = ms.ToArray();
                await writeStream.WriteAsync(bytes, 0, bytes.Length);
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> ConfirmOrder()
        {
            var response = await _orderRepository.ConfirmOrderAsync(this.User.Identity.Name);

            if (response != null)
            {
                try
                {
                    PdfGenerator generator = new PdfGenerator();

                    var pdf = generator.CreatePdf(response, User.Identity.Name);

                    _mailHelper.SendMailWithPDF(User.Identity.Name, "Order Confirmation",
                                                "You can find your order's details in the attachment.", pdf);

                    return(View());
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError(string.Empty, ex.Message);
                }
            }
            return(this.RedirectToAction("Index"));
        }