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 ActionResult Register() { FilmDAO fiDao = new FilmDAO(); CategoryDAO cDao = new CategoryDAO(); RegisterModel register = new RegisterModel { Account = new Account(), TopFilm = fiDao.GetTopFilm(5), NewFilm = fiDao.GetTopNewestFilm(5), ListCategory = cDao.GetAllCategory(), }; return(View(register)); }
// // GET: /Search/ public ActionResult Index(string keyword) { FilmDAO fiDao = new FilmDAO(); CategoryDAO cDao = new CategoryDAO(); SearchModel result = new SearchModel { ListResultFilm = fiDao.SearchFilm(keyword), TopFilm = fiDao.GetTopFilm(5), NewFilm = fiDao.GetTopNewestFilm(5), ListCategory = cDao.GetAllCategory(), }; return(View(result)); }
// // GET: /HomePage/ public ActionResult Home() { FilmDAO fiDao = new FilmDAO(); AccountDAO accDao = new AccountDAO(); CategoryDAO cDao = new CategoryDAO(); HomeModel home = new HomeModel { MainListFilm = fiDao.GetListFilm(), TopFilm = fiDao.GetTopFilm(5), NewFilm = fiDao.GetTopNewestFilm(5), Account = null, ListCategory = cDao.GetAllCategory(), }; return(View(home)); }
// // GET: /Category/ public ActionResult View(int id) { CategoryDAO cDao = new CategoryDAO(); FilmDAO fiDao = new FilmDAO(); var listCat = cDao.GetAllCategory(); CategoryModel cm = new CategoryModel() { ListCategory = listCat, CurrentCat = cDao.GetACategory(id), Account = null, TopFilm = fiDao.GetTopFilm(5), NewFilm = fiDao.GetTopNewestFilm(5), FilmOfThisCategory = fiDao.GetListFilmOfACategory(id), }; return(View(cm)); }
// // GET: /Film/View/id public ActionResult View(int?id) { if (id == null) { return(RedirectToAction("Home", "HomePage")); } int filmId = id ?? 1; FilmDAO fiDao = new FilmDAO(); AccountDAO accDao = new AccountDAO(); CategoryDAO cDao = new CategoryDAO(); CommentDAO commentDao = new CommentDAO(); FilmDetailModel model = new FilmDetailModel { ListCategory = cDao.GetAllCategory(), Account = null, Film = fiDao.GetDetailAFilm(filmId), ListComment = commentDao.GetAllCommentOfAFilm(filmId), TopFilm = fiDao.GetTopFilm(5), NewFilm = fiDao.GetTopNewestFilm(5) }; fiDao.IncreaseViewCount(filmId);//increase viewcount return(View(model)); }