Inheritance: IValidatableObject
        public ActionResult Register(AccountRegisterViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            // insert the desired account credentials
            var account = m_session.Accounts.Insert(new Account
            {
                Email = model.Email,
                Password = model.Password,
                IsAdmin = true
            });

            if (account == null)
            {
                ModelState.AddModelError("Email", "Registration failed");
                return View(model);
            }

            try
            {
                // save the new account to the database
                if (m_session.SaveChanges())
                {
                    // set auth cookie
                    FormsAuthentication.SetAuthCookie(account.Email, true);

                    return RedirectToAction("Index", "Character");
                }
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var entity in ex.EntityValidationErrors)
                {
                    foreach (var error in entity.ValidationErrors)
                    {
                        ModelState.AddModelError(error.PropertyName, error.ErrorMessage);
                    }
                }
            }

            return View(model);
        }
        public ActionResult Register(AccountRegisterViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            try
            {
                // insert the desired account credentials
                var account = m_session.Accounts.Insert(new Account
                {
                    Email = model.Email,
                    Password = model.Password,
                    IsAdmin = true
                });

                if (account == null)
                {
                    ModelState.AddModelError("Email", "Registration failed");
                    return View(model);
                }

                // save the new account to the database
                if (m_session.SaveChanges())
                {
                    // set auth cookie
                    FormsAuthentication.SetAuthCookie(account.Email, true);

                    return RedirectToAction("Index", "Character");
                }
            }
            catch (DbEntityValidationException ex)
            {
                ControllerUtilities.MergeValidationErrors(ModelState, ex);
            }

            return View(model);
        }
        public ActionResult Register()
        {
            var model = new AccountRegisterViewModel();

            return View(model);
        }