public ActionResult Login(LoginModel model, string ReturnUrl) { if (ModelState.IsValid) { using (var db = new DAO.Entities()) { var passHas = CoreFunction.GetMd5Hash(model.pass); var accountData = db.asp_User.FirstOrDefault(x => x.account == model.acc && x.password == passHas); if (accountData!= null) { FormsAuthentication.SetAuthCookie(model.acc, false); if (Url.IsLocalUrl(ReturnUrl)) { return Redirect(ReturnUrl); } return RedirectToAction("index", "Home"); } else { TempData["mess"] = "Sai tài khoản hoặc mật khẩu"; } } } return View(model); }
public ActionResult Login(LoginModel model, string ReturnUrl) { if (ModelState.IsValid) { using (var db = new DAO.Entities()) { var passHas = CoreFunction.GetMd5Hash(model.pass); var accountData = db.asp_User.FirstOrDefault(x => x.account == model.acc && x.password == passHas); if (accountData != null) { FormsAuthentication.SetAuthCookie(model.acc, false); if (Url.IsLocalUrl(ReturnUrl)) { return(Redirect(ReturnUrl)); } return(RedirectToAction("index", "Home")); } else { TempData["mess"] = "Sai tài khoản hoặc mật khẩu"; } } } return(View(model)); }
// GET: Admin/Home public ActionResult Index() { using (var db = new DAO.Entities()) { var time = DateTime.Now; //ViewBag.countOderNew = db.BookTours.Where(x => x.BookDate <= time && (x.Status == 0 || x.Status == 1 || x.Status == 2)).Count(); //ViewBag.countOderDone = db.BookTours.Where(x => x.BookDate <= time && x.Status == 4).Count(); //ViewBag.countOderPenDing = db.BookTours.Where(x => x.Status == 3).Count(); } for (int i = 0; i < 1000; i++) { } return(View()); }
// GET: Admin/Home public ActionResult Index() { using (var db = new DAO.Entities()) { var time = DateTime.Now; //ViewBag.countOderNew = db.BookTours.Where(x => x.BookDate <= time && (x.Status == 0 || x.Status == 1 || x.Status == 2)).Count(); //ViewBag.countOderDone = db.BookTours.Where(x => x.BookDate <= time && x.Status == 4).Count(); //ViewBag.countOderPenDing = db.BookTours.Where(x => x.Status == 3).Count(); } for (int i = 0; i < 1000; i++) { } return View(); }