Beispiel #1
0
        public ActionResult CreateAnAccount(Account account)
        {
            if (ModelState.IsValid && account.Password == account.ConfirmPassword)
            {
                account.Password = SecurePassword(account.Password);
                account.Create();
                return RedirectToAction("Index", "Home");
            }

            return View(new CreateAccount { Account = account });
        }
Beispiel #2
0
 public CreateAccount()
 {
     Account = new Account();
 }
Beispiel #3
0
        public static Account Get(int id)
        {
            using (var conn = Sql.GetSqlConnection())
            {
                conn.Open();
                using (var dr = (new SqlCommand
                {
                    Connection = conn,
                    CommandType = CommandType.StoredProcedure,
                    CommandText = "Security.GetAccount"
                }).ExecuteReader())
                {
                    if (!dr.Read())
                        return null;

                    var account = new Account(dr);

                    dr.NextResult();

                    while (dr.Read())
                        account.PhoneNumbers.Add(new PhoneNumber
                        {
                            Id = Convert.ToInt32(dr["PhoneNumberId"]),
                            PhoneNumberType = Convert.ToString(dr["PhoneNumberType"]),
                            Value = Convert.ToString(dr["PhoneNumber"]),
                            PhoneNumberTypeId = Convert.ToInt32(dr["PhoneNumberTypeId"])
                        });

                    return account;
                }
            }
        }