public ActionResult Edit(Account account)
 {
     if (ModelState.IsValid)
     {
         AccountRepository _accountRepository = new AccountRepository();
         _accountRepository.SaveAccount(account);
     }
     return RedirectToAction("Accounts");
 }
 /// <summary>
 /// Create a new Account object.
 /// </summary>
 /// <param name="accountID">Initial value of the AccountID property.</param>
 /// <param name="username">Initial value of the Username property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="passwordSalt">Initial value of the PasswordSalt property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="lastModifiedDate">Initial value of the LastModifiedDate property.</param>
 /// <param name="lastLoginDate">Initial value of the LastLoginDate property.</param>
 /// <param name="isActivated">Initial value of the IsActivated property.</param>
 /// <param name="isLockedOut">Initial value of the IsLockedOut property.</param>
 /// <param name="lastLockedOutDate">Initial value of the LastLockedOutDate property.</param>
 public static Account CreateAccount(global::System.Int32 accountID, global::System.String username, global::System.String email, global::System.String password, global::System.String passwordSalt, global::System.DateTime createdDate, global::System.DateTime lastModifiedDate, global::System.DateTime lastLoginDate, global::System.Boolean isActivated, global::System.Boolean isLockedOut, global::System.DateTime lastLockedOutDate)
 {
     Account account = new Account();
     account.AccountID = accountID;
     account.Username = username;
     account.Email = email;
     account.Password = password;
     account.PasswordSalt = passwordSalt;
     account.CreatedDate = createdDate;
     account.LastModifiedDate = lastModifiedDate;
     account.LastLoginDate = lastLoginDate;
     account.IsActivated = isActivated;
     account.IsLockedOut = isLockedOut;
     account.LastLockedOutDate = lastLockedOutDate;
     return account;
 }
        public MembershipUser CreateMembershipUser(string username, string password, string email, bool isApproved)
        {
            Account account = new Account();

                account.Username = username;
                account.Email = email;
                account.PasswordSalt = _crypt.CreateSalt();
                account.Password = _crypt.CreatePasswordHash(password, account.PasswordSalt);
                account.CreatedDate = DateTime.Now;

                if (!isApproved)
                {
                    account.IsActivated = false;
                    account.NewEmailKey = GenerateKey();
                }
                else
                    account.IsActivated = true;

                account.IsLockedOut = false;
                account.LastLockedOutDate = DateTime.Now;
                account.LastLoginDate = DateTime.Now;
                account.LastModifiedDate = DateTime.Now;

                account.DateBirthday = DateTime.Now;

                _db.AddToAccounts(account);
                _db.SaveChanges();

                if (!isApproved)
                {
                    string ActivationLink = ConfigurationManager.AppSettings.Get("base_application_url") + "Account/Activate/" + account.Username + "/" + account.NewEmailKey;

                    _notifyService.SendMessage(account.Email, "Actiovate your account!", _messageGenerator.MessageActivateAccount(account.Username, ActivationLink));
                }

                return GetMembershipUser(username);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Accounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccounts(Account account)
 {
     base.AddObject("Accounts", account);
 }
        public void SaveAccount(Account account)
        {
            Account acc = GetAccountByID(account.AccountID);
            acc.City = account.City;
            acc.Country = account.Country;
            acc.DateBirthday = account.DateBirthday;
            acc.FirstName = account.FirstName;
            acc.LastName = account.LastName;
            acc.Email = account.Email;
            acc.LastModifiedDate = DateTime.Now;

            _db.ApplyCurrentValues<Account>("Accounts", acc);
            _db.SaveChanges();
        }