Codestellation.Ether.Templating.Razor.RazorMailTemplateEngine.Render C# (CSharp) Метод

Render() публичный Метод

public Render ( object mailModel ) : MailView
mailModel object
Результат Codestellation.Ether.Core.MailView
        public MailView Render(object mailModel)
        {
            string subject = null;
            string templateClassName = mailModel.GetType().Name;

            var context = new RenderContext();
            do
            {
                RazorMailTemplateBase template = _templatesFactory.Create(templateClassName);
                template.SetContext(context);
                template.SetModel(mailModel);
                template.Execute();

                if (string.IsNullOrEmpty(subject))
                {
                    subject = template.Subject;
                }

                context.Flush();
                templateClassName = template.Layout; // take next

            } while (string.IsNullOrEmpty(templateClassName) == false);

            string body = context.RenderBody();
            return new MailView(subject, body);
        }