예제 #1
0
        public IActionResult Statute(Statute model, string handler)
        {
            var doc = new TextGeneration.Document
            {
                FontName = "Verdana",
                FontSize = 16
            };

            for (int i = 1; i <= 12; i++)
            {
                var paragraphInfo = Program.ReadJson <TextGeneration.Data.Paragraph>(Program.GetParagraphResourceFileName(i));
                doc.Paragraphs.Add(paragraphInfo.BuildDocumentParagraph(model));
            }

            byte[] result;

            string docText = doc.Build(model);

            result = System.Text.Encoding.ASCII.GetBytes(docText);

            return(File(result, "application/rtf", "satzung.rtf", true));
        }
        /// <remarks>
        /// All models need to have "model" in their variable name
        /// </remarks>
        public IActionResult Index(Statute model, string handler, GeneralInformation generalModel)
        {
            if (generalModel != null)
            {
                model.GeneralInformation = generalModel;
            }



            if (handler == "findPurpose")
            {
                model.PurposeInformation.FindPurpose();
            }
            else if (handler == "finalSubmit")
            {
                var doc = new TextGeneration.Document
                {
                    FontName       = "Verdana",
                    FontSize       = 22,
                    FontSizeHeader = 24
                };

                foreach (string paragraphFileName in Program.GetParagraphResources())
                {
                    var paragraphInfo = Program.ReadJson <TextGeneration.Data.Paragraph>(paragraphFileName);
                    doc.Paragraphs.Add(paragraphInfo.BuildDocumentParagraph(model));
                }

                byte[] result;

                result = System.Text.Encoding.ASCII.GetBytes(doc.Build(model));

                return(File(result, "application/rtf", $"Satzung - {model.GeneralInformation.ClubName}.rtf", true));
            }


            return(View(model));
        }