Esempio n. 1
0
 public static AccountViewModel ModelToViewModel(Account account)
 {
     var accountViewModel = new AccountViewModel();
     Mapper.CreateMap<Account, AccountViewModel>();
     Mapper.Map(account, accountViewModel);
     return accountViewModel;
 }
Esempio n. 2
0
 public void UpdateAccount(Account account)
 {
     using (var session = _documentStore.OpenSession())
     {
         session.Store(account);
         session.SaveChanges();
         _logger.Info("Updated account " + account.Name);
     }
 }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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;
        }