public ActionResult Register(RegisterModel user) { UserManage userM = new UserManage(); Model1 db = new Model1(); if (ModelState.IsValid) { if (userM.CheckEmail(user.email) == false && userM.CheckAccount(user.username) == false) { User userDB = new User { Name = user.name, Address = user.address, PhoneNumber = user.phone, Account = user.username, Email = user.email, Password = Encrypt.Encrypts(user.Password) }; db.Users.Add(userDB); db.SaveChanges(); return(RedirectToAction("Login", "User")); } else { ModelState.AddModelError("RegisterFail", "Đăng ký không thành công"); ViewBag.notification = "Username or Email already exist"; } } return(View()); }