Beispiel #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());
        }
Beispiel #3
0
        public static string Create(Context context, SiteSettings ss)
        {
            var tenantModel = new TenantModel(context, ss, 0, setByForm: true);
            var invalid     = TenantValidators.OnCreating(
                context: context,
                ss: ss,
                tenantModel: tenantModel);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(invalid.MessageJson(context: context));
            }
            var error = tenantModel.Create(context: context, ss: ss);

            switch (error)
            {
            case Error.Types.None:
                SessionUtilities.Set(
                    context: context,
                    message: Messages.Created(
                        context: context,
                        data: tenantModel.Title.Value));
                return(new ResponseCollection()
                       .Response("id", tenantModel.TenantId.ToString())
                       .SetMemory("formChanged", false)
                       .Href(Locations.Edit(
                                 context: context,
                                 controller: context.Controller,
                                 id: ss.Columns.Any(o => o.Linking)
                                ? context.Forms.Long("LinkId")
                                : tenantModel.TenantId))
                       .ToJson());

            default:
                return(error.MessageJson(context: context));
            }
        }