Пример #1
0
        public ActionResult SaveAccount(AdminMyAccount m)
        {
            Account myAccount = new Account();
            try
            {
                if (ModelState.IsValid)
                {
                    if (m.Password != m.RetypePassword)
                        throw new Exception("Password and Retype Password must match.");

                    myAccount.AccountID = m.AccountID;
                    myAccount.UserName = m.UserName;
                    myAccount.Password = PasswordHash.CreateHash(m.Password);
                    myAccount.Save();
                }
                else
                {
                    return View("MyAccount", m);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View("MyAccount", m);
            }
            return RedirectToRoute("AdminHome", new { musicalID = m.MusicalID });
        }
Пример #2
0
        public ActionResult MyAccount(int musicalID)
        {
            Account a = new Account(System.Web.HttpContext.Current.User.Identity.Name);
            AdminMyAccount m = new AdminMyAccount();
            m.MusicalID = musicalID;

            if (a.AccountID != 0)
            {
                m.AccountID = a.AccountID;
                m.UserName = a.UserName;
            };

            return View(m);
        }