public ActionResult Register(Register model) { OKhachHang khachHang = new OKhachHang { TenKhach = model.FullName, DienThoai = model.Phone, Email = model.Email, }; khService.Add(khachHang); int idKhach = khService.GetLastId(); OAccount account = new OAccount { Email = khachHang.Email, MaKhach = idKhach, MatKhau = model.Password, TenDN = model.UserName, MaQuyen = 3, }; if (accountService.Register(account)) { Session["Account"] = account; //Random rd = new Random(); //string strRandom; //strRandom = rd.Next(1, 1000).ToString(); //Session["RandomText"] = strRandom; //SendMailActive(account.Email, strRandom); return(RedirectToAction("Index", "Home")); } return(View("Login")); }