Ejemplo n.º 1
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string Register(Context context)
        {
            var ss          = new SiteSettings();
            var passphrase  = Strings.NewGuid();
            var mailAddress = Forms.Data("Users_DemoMailAddress");
            var tenantModel = new TenantModel()
            {
                TenantName = mailAddress
            };

            tenantModel.Create(context: context, ss: ss);
            var demoModel = new DemoModel()
            {
                TenantId    = tenantModel.TenantId,
                Passphrase  = passphrase,
                MailAddress = mailAddress
            };

            demoModel.Create(context: context, ss: ss);
            demoModel.Initialize(context: context, outgoingMailModel: new OutgoingMailModel()
            {
                Title = new Title(Displays.DemoMailTitle()),
                Body  = Displays.DemoMailBody(
                    Locations.DemoUri(passphrase),
                    Parameters.Service.DemoUsagePeriod.ToString()),
                From = new System.Net.Mail.MailAddress(Parameters.Mail.SupportFrom),
                To   = mailAddress,
                Bcc  = Parameters.Mail.SupportFrom
            });
            return(Messages.ResponseSentAcceptanceMail()
                   .Remove("#DemoForm")
                   .ToJson());
        }
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string Register()
        {
            var passphrase  = Strings.NewGuid();
            var mailAddress = Forms.Data("Users_DemoMailAddress");
            var tenantModel = new TenantModel()
            {
                TenantName = mailAddress
            };

            tenantModel.Create();
            var demoModel = new DemoModel()
            {
                TenantId    = tenantModel.TenantId,
                Passphrase  = passphrase,
                MailAddress = mailAddress
            };

            demoModel.Create();
            demoModel.Initialize(new OutgoingMailModel()
            {
                Title = new Title(Displays.DemoMailTitle()),
                Body  = Displays.DemoMailBody(Url.Server(), passphrase),
                From  = new System.Net.Mail.MailAddress(Parameters.Mail.SupportFrom),
                To    = mailAddress,
                Bcc   = Parameters.Mail.SupportFrom
            });
            return(Messages.ResponseSentAcceptanceMail()
                   .Remove("#DemoForm")
                   .ToJson());
        }