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 }); }
public CreateAccount() { Account = new Account(); }
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; } } }