Exemplo n.º 1
0
        public ActionResult DangKyTaiKhoan(TaiKhoanDangKy tkdk)
        {
            if (ModelState.IsValid)
            {
                tkB = new TaiKhoanBusiness();
                TaiKhoan tk = new TaiKhoan();
                tk.Email    = tkdk.EmailDK;
                tk.HoTenLot = tkdk.HoTenLotDK;
                tk.Ten      = tkdk.TenDK;
                //hash mật khẩu
                string mkDaHash;
                using (MD5 md5Hash = MD5.Create())
                {
                    mkDaHash = GetMd5Hash(md5Hash, tkdk.MatKhauDK);
                }
                tk.MatKhau = mkDaHash;
                tk.IdQuyen = 1;

                //Thêm vào database
                tkB.TaiKhoan_Insert(tk);
            }
            ViewBag.tab            = "DangNhap";
            ViewBag.taoTKThanhCong = "Bạn đã tạo tài khoản thành công";
            return(View("DangNhap_DangKyTaiKhoan"));
        }
Exemplo n.º 2
0
        public JsonResult TaoMoiTaiKhoan(TaiKhoanDangKyAdmin t)
        {
            tkB = new TaiKhoanBusiness();
            TaiKhoan tk = new TaiKhoan();

            tk.Email    = t.EmailDK;
            tk.HoTenLot = t.HoTenLotDK;
            tk.Ten      = t.TenDK;
            string passwordHashed;

            using (MD5 md5hash = MD5.Create())
            {
                passwordHashed = GetMd5Hash(md5hash, t.MatKhauDK);
            }
            tk.MatKhau = passwordHashed;
            tk.IdQuyen = t.IdQuyen;
            tkB.TaiKhoan_Insert(tk);
            return(Json(JsonRequestBehavior.AllowGet));
        }