public ActionResult Register(Account account, string Password_Retype) { AccountDAO accountDao = new AccountDAO(); if (Password_Retype.Equals(account.Password)) { bool result = accountDao.AddNewAccount(account); if (result == true) { this.Session.Clear(); this.Session.Add("username", account.Username); this.Session.Add("role", account.Role); return(RedirectToAction("Home", "HomePage")); } TempData["register-error"] = "Tài khoản đã được sử dụng"; } else { TempData["register-error"] = "Mật khẩu không giống nhau"; } FilmDAO fiDao = new FilmDAO(); CategoryDAO cDao = new CategoryDAO(); RegisterModel register = new RegisterModel { Account = account, TopFilm = fiDao.GetTopFilm(5), NewFilm = fiDao.GetTopNewestFilm(5), ListCategory = cDao.GetAllCategory(), }; return(View(register)); }
public bool AddAccount(Account account) { if (!SearchByAccountId(account.AccountID)) { if (_accountDAO.AddNewAccount(account) >= 1) { return(true); } else { return(false); } } return(false); }