Ejemplo n.º 1
0
        private static void FirstTimeSetup()
        {
            // Wait until database is not stale anymore
            RavenContext.Instance.DocumentStore.ClearStaleIndexes();

            if (!DependencyManager.Db.Accounts.GetAccounts().Any())
            {
                var account = new Account
                {
                    Name = "Jesse",
                    Email = "*****@*****.**",
                    IsAdmin = true,
                    Enabled = true,
                    Enterprises = new List<string>()
                };
                account.SetPassword("qwerty");
                DependencyManager.Db.Accounts.AddAccount(account);
            }
        }
Ejemplo n.º 2
0
        public ActionResult AddAccount(AccountViewData account)
        {
            if (account.UserInput.Password != account.UserInput.ConfirmPassword)
            {
                ModelState.AddModelError("ConfirmPassword", "Lösenorden matchar inte!");
            }
            if (ModelState.IsValid)
            {
                var newAccount = new Account
                                  {
                                      Id = AccountHelper.GetId(account.UserInput.Email),
                                      Email = account.UserInput.Email,
                                      Enabled = true,
                                      IsAdmin = false,
                                      Name = account.UserInput.Name,
                                  };
                newAccount.SetPassword(account.UserInput.Password);
                //Repository.AddAccount(newAccount);
            }

            //TODO
            //var accounts = Repository.GetAccounts().Where(a => a.IsAdmin != true);
            //ViewBag.Accounts = accounts;

            return null;
        }