Ejemplo n.º 1
0
        public ActionResult Registry(string tendn, string matkhau, string hoten, string diachi, string email, int sdt)
        {
            var dao   = new TaiKhoanModel();
            var check = new UserDao();

            if (check.CheckTenDn(tendn))
            {
                ViewBag.TenDn = "Đăng ký không thành công. Tên đăng nhập đã tồn tại";
            }
            else if (check.CheckEmail(email))
            {
                ViewBag.Email = "Đăng ký không thành công. Email đã tồn tại";
            }
            else
            {
                int result = dao.Registry(tendn, matkhau, hoten, diachi, email, sdt);
                if (result > 0)
                {
                    ViewBag.Sucess = "Đăng ký thành công";
                }
                else
                {
                    ViewBag.Failure = "Đăng ký thất bại";
                }
            }

            return(View("Index"));
        }