Beispiel #1
0
        public IActionResult Resgiter(KhachHangView model)
        {
            if (ModelState.IsValid)
            {
                //map tu KhachHang sang model
                KhachHang khachHang = _mapper.Map <KhachHang>(model);

                //viet xu ly tren mytool
                //Ham GenerateRandomKey, ToMD5.  viet ben my tool
                khachHang.RandomKey = MyTool.GenerateRandomKey();
                khachHang.MatKhau   = (model.MatKhau + khachHang.RandomKey).ToMD5();

                _content.Add(khachHang);
                _content.SaveChanges();
                return(RedirectToAction("Login"));
            }
            return(View());
        }